, (*1)
BroadwayGeneratorBundle
This bundle gives some symfony commands to generate Commands, Events, ReadModels, and more, for Broadway., (*2)
This bundle is highly inspired by SensioGeneratorBundle, (*3)
## Installation, (*4)
Install it with composer, (*5)
composer require romaindesajardim/broadway-generator-bundle
, (*6)
and add it to your AppKernel.php
, (*7)
new RomainDeSaJardim\Bundle\BroadwayGeneratorBundle\BroadwayGeneratorBundle(),
, (*8)
## Features, (*9)
Actually there is only one command available. More will come soon ..., (*10)
### Broadway Commands, (*11)
This command generate a Broadway command and implements the handle method in the Broadway Command Handler automatically. You have just to add your parameters and code the handler., (*12)
php bin/console rdsj:broadway:generate-command
, (*13)
:warning: If you use Symfony 2, use app/console
instead of bin/console
, (*14)
This command need 3 inputs :, (*15)
-
bundle
(The bundle name where the Broadway Command will be generate)
-
name
(The name of the Broadway Command you want)
-
command-handler
Optionnal (The Command Handler's service id where the Broadway Command will be handle), (*16)
By default the command is run in the interactive mode and asks questions to determine values of thoose inputs, (*17)
But if you want, you can run the command in a non-interactive mode and providing the needed inputs, (*18)
php bin/console rdsj:broadway:generate-command --no-interaction FooBarBundle FooBar [foo.bar-handler]
, (*19)
Exemple
Imagine I have my Broadway Command Handler FooBarBundle\FooBarCommandHandler
linked by a Symfony service :, (*20)
```
, (*21)
And I want to create a Broadway Command `FooBar` in the same bundle as my Command Handler `FooBarBundle`
So in a non interactive mode I have to launch this command :
`php bin/console rdsj:broadway:generate-command --no-interaction FooBarBundle FooBar foo.bar.command_handler`
The result will be :
A new file `Command\FooBarCommand.php`
uuid = $uuid;
}
public function getUUID()
{
return $this->uuid;
}
}
```
And a new handle method a the end of my Command Handler `FooBarCommandHandler.php`
```
public function handleFooBar(FooBarCommand $command)
{
// @TODO Insert your code here
}
```
### Broadway Events
This command generate a Broadway event and implements the handle method in the Broadway Projector automatically. You have just to add your parameters and code the handler.
```php bin/console rdsj:broadway:generate-event```
:warning: If you use Symfony 2, use `app/console` instead of `bin/console`
This command need 3 inputs :
* `bundle` _(The bundle name where the Broadway Command will be generate)_
* `name` _(The name of the Broadway Command you want)_
* `projector` Optionnal _(The Projector's service id where the Broadway Event will be handle)_
By default the command is run in the interactive mode and asks questions to determine values of thoose inputs
But if you want, you can run the command in a non-interactive mode and providing the needed inputs
```php bin/console rdsj:broadway:generate-command --no-interaction FooBarBundle FooBar [foo.bar-projector]```
#### Exemple
Same as Broadway Commands' one
### Broadway ReadModel's
This command generate a Broadway ReadModel and add it to the service configuration of you're bundle. You have just to add your parameters and code the ReadModel.
```php bin/console rdsj:broadway:generate-readmodel```
:warning: If you use Symfony 2, use `app/console` instead of `bin/console`
This command need 3 inputs :
* `bundle` _(The bundle name where the Broadway Command will be generate)_
* `name` _(The name of the Broadway Command you want)_
* `service-filename` Optionnal _(The service filename is the name of the file where your bundle services are configurated)
By default the command is run in the interactive mode and asks questions to determine values of thoose inputs
But if you want, you can run the command in a non-interactive mode and providing the needed inputs
```php bin/console rdsj:broadway:generate-readmodel --no-interaction FooBarBundle FooBar [services.xml]```
#### Exemple
```php bin/console rdsj:broadway:generate-readmodel --no interaction FooBarBundle FooBar services.xml```
This command generate a ReadModel like this.
```
id = $id;
}
public function getId()
{
return $this->id;
}
}
```
and transform `service.xml`
```
, (*22)
```, (*23)
in, (*24)
```
toto.readmodel
AppBundle\ReadModel\TotoReadModel
, (*25)
```
in order to configure the new ReadModel service, (*26)
TODO
- [ ] Add a command to apply or handle an event in a projector, processor or saga
- [x] Add a command to generate Broadway Event
- [x] Add a command to generate Broadway ReadModel
- [ ] Add a command to generate Broadway Command Handler
- [ ] Generate Command handler automatically if it doesn't exist on Broadway Command creation
- [ ] Add fields to Broadway Command to add fields and implements getters
Reporting an issue or a feature request
You feel free to report a new issue or a feature requests if it doesn't already exist or is in the Todo list (for feature request), (*27)
Contribute
You feel free to open pull request, (*28)