1. Go to this page and download the library: Download rezzza/domain-event library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
rezzza / domain-event example snippets
class ORMBookingRepository extends ORMAggregateRootRepository implements BookingRepository
{
public function find($bookingId)
{
$this->getInternalRepository->find($bookingId)
}
public function save(Booking $booking)
{
$this->getManager()->persist($booking);
$this->getManager()->flush();
$this->track($booking);
}
}
$repository = new ORMBookingRepository(
new ManagerRegistry,
'My\FQCN\Booking',
new ChangeTracker(
new LoggerEventBus(
$logger,
new CompositeEventBus([
new SymfonyEventBus($eventDispatcher),
new RedisEventBus($redis, 'booking')
])
)
)
);