diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 90d6d37..b0452fe 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -24,7 +24,7 @@ - + diff --git a/src/DependencyInjection/ZapoyokCQRSExtension.php b/src/DependencyInjection/ZapoyokCQRSExtension.php new file mode 100644 index 0000000..efc35f9 --- /dev/null +++ b/src/DependencyInjection/ZapoyokCQRSExtension.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Zapoyok\CQRSBundle\DependencyInjection; + +use Symfony\Component\Config\Definition\Processor; +use Symfony\Component\Config\FileLocator; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Extension\Extension; +use Symfony\Component\DependencyInjection\Loader\PhpFileLoader; + +final class ZapoyokCQRSExtension extends Extension +{ + public function load(array $configs, ContainerBuilder $container): void + { + $processor = new Processor(); + // $configuration = new Configuration(); + // + // $config = $processor->processConfiguration($configuration, $configs); + $loader = new PhpFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); + $loader->load('services.php'); + } +} diff --git a/src/DomainModel/TriggerEventsTrait.php b/src/DomainModel/TriggerEventsTrait.php index 3d57d75..fa8730a 100644 --- a/src/DomainModel/TriggerEventsTrait.php +++ b/src/DomainModel/TriggerEventsTrait.php @@ -23,6 +23,15 @@ trait TriggerEventsTrait return $this->domainEvents; } + /** @return DomainEventInterface[] */ + public function retrieveAndFlushDomainEvents(): array + { + $events = $this->domainEvents(); + $this->resetDomainEvent(); + + return $events; + } + public function notifyDomainEvent(DomainEventInterface $domainEvent): void { $this->domainEvents[] = $domainEvent; diff --git a/src/Event/EventBusInterface.php b/src/Event/EventBusInterface.php index cb2e307..a0bd6c0 100644 --- a/src/Event/EventBusInterface.php +++ b/src/Event/EventBusInterface.php @@ -12,7 +12,7 @@ declare(strict_types=1); namespace Zapoyok\CQRSBundle\Event; -use Scc\CQRSBundle\DomainModel\DomainEventInterface; +use Zapoyok\CQRSBundle\DomainModel\DomainEventInterface; interface EventBusInterface { diff --git a/src/Event/MessengerEventBus.php b/src/Event/MessengerEventBus.php index 5dac820..48649a4 100644 --- a/src/Event/MessengerEventBus.php +++ b/src/Event/MessengerEventBus.php @@ -12,8 +12,8 @@ declare(strict_types=1); namespace Zapoyok\CQRSBundle\Event; -use Scc\CQRSBundle\DomainModel\DomainEventInterface; use Symfony\Component\Messenger\MessageBusInterface; +use Zapoyok\CQRSBundle\DomainModel\DomainEventInterface; final class MessengerEventBus implements EventBusInterface { diff --git a/src/Resources/config/services.php b/src/Resources/config/services.php index 3cca2a5..a3b40c3 100644 --- a/src/Resources/config/services.php +++ b/src/Resources/config/services.php @@ -10,14 +10,8 @@ declare(strict_types=1); * file that was distributed with this source code. */ -use Psr\Log\LoggerAwareInterface; -use Scc\VotingBundle\Collection\VotingMethodCollection; -use Scc\VotingBundle\Contract\ElectionMethodAdapterInterface; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; -use function symfony\component\dependencyinjection\loader\configurator\service; -use function Symfony\Component\DependencyInjection\Loader\Configurator\tagged_iterator; - return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); @@ -27,23 +21,11 @@ return static function (ContainerConfigurator $containerConfigurator): void { ->autoconfigure() ; - // $services - // ->instanceof(LoggerAwareInterface::class) - // ->call('setLogger', [service('logger')]); - // - // $services - // ->instanceof(ElectionMethodAdapterInterface::class) - // ->tag('scc_voting.method'); - - $services->load('Scc\CQRSBundle\\', __DIR__ . '/../../../src') + $services->load('Zapoyok\CQRSBundle\\', __DIR__ . '/../../../src') ->exclude([ __DIR__, - __DIR__ . '/../../../src/SccCQRSBundle.php', + __DIR__ . '/../../../src/ZapoyokCQRSBundle.php', __DIR__ . '/../../../src/{DependencyInjection}', ]) ; - - // $services->set(VotingMethodCollection::class) - // ->args([tagged_iterator('scc_voting.method')]); - // $services->alias('scc_voting.method.collection', VotingMethodCollection::class); }; diff --git a/src/ZapoyokCQRSBundle.php b/src/ZapoyokCQRSBundle.php new file mode 100644 index 0000000..452adb0 --- /dev/null +++ b/src/ZapoyokCQRSBundle.php @@ -0,0 +1,19 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Zapoyok\CQRSBundle; + +use Symfony\Component\HttpKernel\Bundle\Bundle; + +final class ZapoyokCQRSBundle extends Bundle +{ +} diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 1636df4..a6b54d2 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -2,10 +2,9 @@ declare(strict_types=1); -/* - * This file is part of the Sonata Project package. - * - * (c) Thomas Rabaix +/** + * This file is part of the zapoyok.info project. + * (c) * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code.