maker-bundle
maker-bundle copied to clipboard
[make:event] Add command for making Event class
I think adding "make:event" that makes Event class is good, although that is a small feature.
So, I wrote a simple make command.
php bin/console make:event
The name of the event class (e.g. OrderPlacedEvent):
> ItemCreatedEvent
Field name (press enter to stop adding fields):
> id
Field type (e.g. string) [string]:
> int
Field visibility (public, protected, private) [public]:
[0] public
[1] private
[2] protected
> public
Can this field be null (nullable) (yes/no) [no]:
> no
Field name (press enter to stop adding fields):
>
It makes bellow
<?php
namespace App\Event;
use Symfony\Contracts\EventDispatcher\Event;
final class ItemCreatedEvent extends Event
{
public function __construct(
public readonly int $id,
) {
}
}