Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
phansys committed Sep 6, 2020
1 parent d63eb6f commit 5c4718d
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 68 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Simple ticketing bundle for any project.

## Requirements

[Packagist](https://packagist.org/packages/hackzilla/ticket-bundle)
You can see the full requirement definitions for each available version in [Packagist](https://packagist.org/packages/hackzilla/ticket-bundle).

## Setup

Expand Down
2 changes: 1 addition & 1 deletion Resources/doc/migrate/v1-to-v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Add your user class into your config.

```yaml
hackzilla_ticket:
user_class: AppBundle\Entity\User
user_class: App\Entity\User
```
```Hackzilla\Bundle\TicketBundle\User\UserInterface``` has been replaced with ```Hackzilla\Bundle\TicketBundle\Manager\UserManagerInterface```
Expand Down
45 changes: 27 additions & 18 deletions Resources/doc/setup/feature/attachments.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,50 @@

## Attachments

Add UploaderBundle in your composer.json:
Add UploaderBundle to your requirements:

```json
{
"require": {
"hackzilla/ticket-bundle": "~3.0",
"vich/uploader-bundle": "~1.0"
}
}
```bash
composer require vich/uploader-bundle
```

Specify the uploader config, so the bundle knows where to store the files.

```yaml
hackzilla_ticket:
user_class: AppBundle\Entity\User
ticket_class: Hackzilla\Bundle\TicketBundle\Entity\TicketWithAttachment
message_class: Hackzilla\Bundle\TicketBundle\Entity\TicketMessageWithAttachment
user_class: App\Entity\User
ticket_class: Hackzilla\Bundle\TicketBundle\Entity\TicketWithAttachment
message_class: Hackzilla\Bundle\TicketBundle\Entity\TicketMessageWithAttachment
features:
attachment: true
attachment: true

vich_uploader:
db_driver: orm

mappings:
ticket_message_attachment:
uri_prefix: /attachment
upload_destination: %kernel.root_dir%/../var/uploads/attachment/
uri_prefix: /attachment
upload_destination: '%kernel.root_dir%/../var/uploads/attachment/'
```
See [VichUploaderBundle](https://github.com/dustin10/VichUploaderBundle/blob/master/Resources/doc/index.md) documentation for more details.
Don't forget to register VichUploaderBundle in AppKernel.
If you are not using [Symfony Flex](https://symfony.com/doc/current/setup/flex.html), you must enable the bundles manually in the kernel:
```php
<?php
// config/bundles.php

return [
Vich\UploaderBundle\VichUploaderBundle => ['all' => true],
Hackzilla\Bundle\TicketBundle\HackzillaTicketBundle::class => ['all' => true],
// ...
// Your application bundles
];
```

If you are using an older kernel implementation, you must update the `registerBundles()` method:

``` php
```php
<?php
// app/AppKernel.php

Expand All @@ -54,6 +63,6 @@ public function registerBundles()

## Custom Entity

If you want to implement your own entities then you will want to extend
If you want to implement your own entities then you will want to extend

``` \Hackzilla\Bundle\TicketBundle\Model\TicketFeature\MessageAttachmentInterface ```
8 changes: 4 additions & 4 deletions Resources/doc/setup/feature/custom-entities.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ Once you've defined your entities then you will need to override the builtin one

```yaml
hackzilla_ticket:
ticket_class: AppBundle\Entity\Ticket
message_class: AppBundle\Entity\TicketMessage
ticket_class: App\Entity\Ticket
message_class: App\Entity\TicketMessage
```
Expand All @@ -28,14 +28,14 @@ hackzilla_ticket:
### Traits
To make creating your own entities a little easier there are traits.
The only thing missing form the traits are the primary id. This will allow you to use whatever you want as the primary id, whether its int or uuid.
The only thing missing form the traits are the primary id. This will allow you to use whatever you want as the primary id, whether its int or uuid.
| Entity | Trait |
| --------------- | --------------------------------------------------------------------------------- |
| Ticket | Hackzilla\Bundle\TicketBundle\Entity\Traits\TicketTrait |
| Ticket Message | Hackzilla\Bundle\TicketBundle\Entity\Traits\TicketMessageTrait |
| Ticket Message | Hackzilla\Bundle\TicketBundle\Entity\Traits\TicketFeature\MessageAttachmentTrait |
At the moment they only support xml configuration. Use the [TicketBundle xml](Resources/config/doctrine/model) as a basis and copy it into your bundle.
At the moment they only support xml configuration. Use the [TicketBundle xml](Resources/config/doctrine/model) as a basis and copy it into your bundle.
If you know of a better way, then either open an Issue or Pull Request.
13 changes: 6 additions & 7 deletions Resources/doc/setup/feature/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,19 @@

TicketBundle show fires events for creating, updating, and deleting of tickets.

* hackzilla.ticket.create
* hackzilla.ticket.update
* hackzilla.ticket.delete
* `hackzilla.ticket.create`
* `hackzilla.ticket.update`
* `hackzilla.ticket.delete`

See for example of how to create listener: http://symfony.com/doc/current/cookbook/service_container/event_listener.html


Add your user, ticket and ticket message entities into your config.

```yaml
hackzilla_ticket:
user_class: AppBundle\Entity\User
ticket_class: AppBundle\Entity\Ticket
message_class: AppBundle\Entity\Message
user_class: App\Entity\User
ticket_class: App\Entity\Ticket
message_class: App\Entity\Message
```
Your entities needs to implement:
Expand Down
17 changes: 7 additions & 10 deletions Resources/doc/setup/fosuserbundle.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,17 @@

## Step 1: Installation

Add HackzillaTicketBundle to your requirements:
Add HackzillaTicketBundle and FOSUserBundle to your requirements:

```bash
composer require hackzilla/ticket-bundle:^2.0@dev
composer require friendsofsymfony/user-bundle:^2.0
composer require hackzilla/ticket-bundle friendsofsymfony/user-bundle
```

Specify your user class in your config, this will be exactly the same as `user_class` in FOSUserBundle.

```yaml
hackzilla_ticket:
user_class: AppBundle\Entity\User
user_class: App\Entity\User
```
Your user class needs to implement ```Hackzilla\Bundle\TicketBundle\Model\UserInterface```
Expand All @@ -23,7 +22,7 @@ You'll end up with a class like:
```php
<?php
namespace AppBundle\Entity;
namespace App\Entity;
use FOS\UserBundle\Model\User as BaseUser;
Expand All @@ -32,11 +31,11 @@ class User extends BaseUser implements \Hackzilla\Bundle\TicketBundle\Model\User
}
```

Follow [FOSUserBundle guide][1]
Follow [FOSUserBundle guide](https://github.com/FriendsOfSymfony/FOSUserBundle)

## Step 2: Enable the bundle

Enable the bundle in the kernel:
If you are not using [Symfony Flex](https://symfony.com/doc/current/setup/flex.html), you must enable the bundles manually in the kernel:

```php
<?php
Expand All @@ -52,7 +51,7 @@ return [
];
```

Or if you are not using Flex:
If you are using an older kernel implementation, you must update the `registerBundles()` method:

```php
<?php
Expand Down Expand Up @@ -96,5 +95,3 @@ You can assign "ROLE_TICKET_ADMIN" to any user you want to be able to administer
## Step 5: Create tables

```bin/console doctrine:schema:update --force```

[1]: https://github.com/FriendsOfSymfony/FOSUserBundle
49 changes: 22 additions & 27 deletions Resources/doc/setup/other.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,17 @@

## Step 1: Installation

Add HackzillaTicketBundle in your composer.json:
Add HackzillaTicketBundle to your requirements:

```json
{
"require": {
"hackzilla/ticket-bundle": "~2.0@dev",
}
}
```bash
composer require hackzilla/ticket-bundle
```

Specify your user class in your config, if you are using FOSUserBundle, then this will be exactly the same.

```yaml
hackzilla_ticket:
user_class: AppBundle\Entity\User
user_class: App\Entity\User
```
Your user class needs to implement ```Hackzilla\Bundle\TicketBundle\Model\UserInterface```
Expand All @@ -26,34 +22,33 @@ You should end up with a class similar to:
```php
<?php
namespace AppBundle\Entity;
namespace App\Entity;
class User implements \Hackzilla\Bundle\TicketBundle\Model\UserInterface
{
}
```

## Step 2: Enable the bundle

Install Composer

```
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
```
Now tell composer to download the library by running the command:
If you are not using [Symfony Flex](https://symfony.com/doc/current/setup/flex.html), you must enable the bundles manually in the kernel:

``` bash
$ composer update hackzilla/ticket-bundle
```php
<?php
// config/bundles.php
return [
Knp\Bundle\PaginatorBundle\KnpPaginatorBundle::class => ['all' => true],
Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true],
Hackzilla\Bundle\TicketBundle\HackzillaTicketBundle::class => ['all' => true],
// ...
// Your application bundles
];
```

Composer will install the bundle into your project's `vendor/hackzilla` directory.

## Step 2: Enable the bundle

Enable the bundle in the kernel:
If you are using an older kernel implementation, you must update the `registerBundles()` method:

``` php
```php
<?php
// app/AppKernel.php
Expand All @@ -75,15 +70,15 @@ public function registerBundles()
``` yml
hackzilla_ticket:
resource: "@HackzillaTicketBundle/Resources/config/routing.yml"
prefix: /
prefix: /
```

or

``` yml
hackzilla_ticket:
resource: "@HackzillaTicketBundle/Resources/config/routing/ticket.yml"
prefix: /ticket
prefix: /ticket
```

## Step 4: Roles
Expand Down

0 comments on commit 5c4718d

Please sign in to comment.