Releases: gpslab/domain-event-bundle
Release 2.3.1
Changelog (since 2.3.0...2.3.1
)
- bug #12 Compatible with Doctrine ORM >= 2.7 (@peter-gribanov)
- bug #13 Configure GitHub Actions (@peter-gribanov)
- bug #14 Build from GitHub CI (@peter-gribanov)
- bug #15 Correct show PHP version in GitHub CI (@peter-gribanov)
- bug #16 Change badges in README file (@peter-gribanov)
Release 2.3.0
Changelog (since 2.2.0...2.3.0
)
- feature #10 Allow use Symfony 5 (@peter-gribanov)
- feature #11 Use PHPUnit 4.8.36 with namespaces (@peter-gribanov)
Release 2.2.0
Changelog (since 2.1.4...2.2.0
)
- bug #8 Not test with Doctrine 2.4 (@peter-gribanov)
- feature #7 Install
GpsLabDomainEventBundle
by Symfony Flex (@peter-gribanov) - bug #6 Change composer requirements (@peter-gribanov)
Release 2.1.4
Changelog (since 2.1.3...2.1.4
)
- bug #5 Correct project type to "symfony-bundle" (@peter-gribanov)
- bug #4 Correct test build with Travic CI (@peter-gribanov)
Release 2.1.3
Changelog (since 2.1.2...2.1.3
)
- Restore tests
- Change build icons
Release 2.1.2
Changelog (since 2.1.1...2.1.2
)
- Pull events from initialized Doctrine proxy classes [Bugfix]
- Test on PHP 7.2
- Test with Symfony 3.4, 4.1 and Doctrine 2.6
- Create service aliases for EventBus and EventQueue
- Subscribers tagged automatically
Release 2.1.1
Changelog (since 2.1.0...2.1.1
)
-
Added ability to subscribe to events.
use GpsLab\Domain\Event\Event; use GpsLab\Domain\Event\Listener\Subscriber; class SendEmailOnPurchaseOrderCreated implements Subscriber { private $mailer; public function __construct(\Swift_Mailer $mailer) { $this->mailer = $mailer; } public static function subscribedEvents() { return [ PurchaseOrderCreatedEvent::class => ['onPurchaseOrderCreated'], ]; } public function onPurchaseOrderCreated(PurchaseOrderCreatedEvent $event) { $message = $this->mailer ->createMessage() ->setTo('recipient@example.com') ->setBody(sprintf( 'Purchase order created at %s for customer #%s', $event->getCreateAt()->format('Y-m-d'), $event->getCustomer()->getId() )); $this->mailer->send($message); } }
Register event subscriber
services: acme.domain.purchase_order.event.created.send_email_subscriber: class: SendEmailOnPurchaseOrderCreated arguments: [ '@mailer' ] tags: - { name: domain_event.subscriber }
Release 2.1.0
Changelog (since 2.0.1...2.1.0
)
-
Publish domain events on Doctrine events
PreRemove
/PostRemove
[Bugfix]Befire:
PreRemove
andPostRemove
events is ignored.After:
If you need do somthing after entity is removed you can usePreRemove
/PostRemove
Lifecycle Events./** * @ORM\Table(name="article") * @ORM\Entity() * @ORM\HasLifecycleCallbacks() */ class Article { /** * @ORM\Id * @ORM\GeneratedValue(strategy="IDENTITY") * @ORM\Column(name="id", type="ArticleId", nullable=false) */ private $id; /** * @ORM\Column(name="cover", type="string", length=255, nullable=true) */ private $cover; // ... /** * @ORM\PreRemove() */ public function preRemove() { // remove cover after remove article $this->raise(new ArticleRemoved($this->id, $this->cover)); } /** * @ORM\PostRemove() */ public function postRemove() { // $this->id is null } }
Release 2.0.1
Changelog (since 2.0.0...2.0.1
)
- Correct
domain_event.bus.listener_located
service name.
Release 2.0.0
Changelog (since 1.1.0...2.0.0
)
Configuration
Before:
gpslab_domain_event:
# Event bus service
# Support 'listener_locator', 'queue' or a custom service
# As a default used 'listener_locator'
bus: 'listener_locator'
# Event queue service
# Support 'memory', 'memory_unique' or a custom service
# As a default used 'memory_unique'
queue: 'memory_unique'
# Event listener locator
# Support 'voter', 'named_event' or custom service
# As a default used 'named_event'
locator: 'named_event'
# Evant name resolver used in 'named_event' event listener locator
# Support 'event_class', 'event_class_last_part', 'named_event' or a custom service
# As a default used 'event_class'
name_resolver: 'event_class'
After:
gpslab_domain_event:
# Event bus service
# Support 'listener_located', 'queue' or a custom service
# As a default used 'listener_located'
bus: 'listener_located'
# Event queue service
# Support 'pull_memory', 'subscribe_executing' or a custom service
# As a default used 'pull_memory'
queue: 'pull_memory'
# Event listener locator
# Support 'symfony', 'container', 'direct_binding' or custom service
# As a default used 'symfony'
locator: 'symfony'
# Publish domain events post a Doctrine flush event
# As a default used 'false'
publish_on_flush: true
Publish domain events
- Publish domain events post a Doctrine flush event.
Removed locators
- Removed
domain_event.locator.voter
service. - Removed
domain_event.locator.named_event
service. - Ignore tag
domain_event.locator.voter
forVoterLocator
. - Ignore tag
domain_event.locator.named_event
forNamedEventLocator
.
Created locators
- Created
domain_event.locator.symfony
service of
GpsLab\Domain\Event\Listener\Locator\SymfonyContainerEventListenerLocator
locator. - Created
domain_event.locator.container
service of
GpsLab\Domain\Event\Listener\Locator\ContainerEventListenerLocator
locator. - Created
domain_event.locator.direct_binding
service of
GpsLab\Domain\Event\Listener\Locator\DirectBindingEventListenerLocator
locator.
Removed name resolvers
- Removed
domain_event.name_resolver.event_class_last_part
name resolver service. - Removed
domain_event.name_resolver.event_class
name resolver service. - Removed
domain_event.name_resolver.named_event
name resolver service.
Removed queue
- Removed
domain_event.queue.memory
queue service. - Removed
domain_event.queue.memory_unique
queue service.
Created queue
- Created
domain_event.queue.pull_memory
service ofGpsLab\Domain\Event\Queue\Pull\MemoryPullEventQueue
queue. - Created
domain_event.queue.subscribe_executing
service of
GpsLab\Domain\Event\Queue\Subscribe\ExecutingSubscribeEventQueue
queue.
Changed event bus
-
Changed class for
domain_event.bus.listener_locator
.Before used
GpsLab\Domain\Event\Bus\Bus
class.After used
GpsLab\Domain\Event\Bus\ListenerLocatedEventBus
class. -
Service
domain_event.bus.queue
not use adomain_event.bus.listener_locator
service.