Initial commit

This commit is contained in:
2023-04-08 09:18:52 +02:00
parent 40e6fa63e5
commit fa6f9d1080
8 changed files with 68 additions and 27 deletions

View File

@@ -24,7 +24,7 @@
<extensions>
<!-- @see https://tomasvotruba.com/blog/2019/03/28/how-to-mock-final-classes-in-phpunit/ -->
<extension class="Scc\PhpUnit\Hook\BypassFinalHook"/>
<extension class="Zapoyok\PhpUnit\Hook\BypassFinalHook"/>
</extensions>
</phpunit>

View File

@@ -0,0 +1,32 @@
<?php
declare(strict_types=1);
/**
* This file is part of the zapoyok.info project.
* (c) <zapoyok.info> <jerome.fix@zapoyok.info>
*
* 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');
}
}

View File

@@ -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;

View File

@@ -12,7 +12,7 @@ declare(strict_types=1);
namespace Zapoyok\CQRSBundle\Event;
use Scc\CQRSBundle\DomainModel\DomainEventInterface;
use Zapoyok\CQRSBundle\DomainModel\DomainEventInterface;
interface EventBusInterface
{

View File

@@ -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
{

View File

@@ -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);
};

19
src/ZapoyokCQRSBundle.php Normal file
View File

@@ -0,0 +1,19 @@
<?php
declare(strict_types=1);
/**
* This file is part of the zapoyok.info project.
* (c) <zapoyok.info> <jerome.fix@zapoyok.info>
*
* 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
{
}

View File

@@ -2,10 +2,9 @@
declare(strict_types=1);
/*
* This file is part of the Sonata Project package.
*
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
/**
* This file is part of the zapoyok.info project.
* (c) <zapoyok.info> <jerome.fix@zapoyok.info>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.