|
2 | 2 |
|
3 | 3 | declare(strict_types=1); |
4 | 4 |
|
5 | | -use Conticket\Conference\Domain\Repository\ConferenceRepositoryInterface; |
6 | | -use Conticket\Conference\Factory\Repository\ConferenceRepositoryFactory; |
7 | | -use Conticket\Conference\Factory\CommandHandler\CreateConferenceHandlerFactory; |
8 | | -use Conticket\Conference\Domain\Command\CreateConference; |
| 5 | +use Conticket\Conference\Infrastructure\Service\ApplicationFactory; |
9 | 6 | use Conticket\Conference\Infrastructure\Service\CommandBusFactory; |
10 | 7 | use Conticket\Conference\Infrastructure\Service\ConnectionFactory; |
11 | 8 | use Conticket\Conference\Infrastructure\Service\EventStoreFactory; |
| 9 | +use Conticket\Conference\Infrastructure\Service\PDOFactory; |
12 | 10 | use Doctrine\DBAL\Connection; |
13 | | -use Interop\Container\ContainerInterface; |
14 | 11 | use Prooph\EventStore\EventStore; |
15 | 12 | use Prooph\ServiceBus\CommandBus; |
16 | 13 | use Zend\Expressive\Application; |
17 | 14 | use Zend\Expressive\Router\FastRouteRouter; |
| 15 | +use Zend\ServiceManager\Factory\InvokableFactory; |
18 | 16 |
|
19 | 17 | return (function () { |
20 | 18 | return [ |
21 | | - // @todo move factories to proper classes |
22 | 19 | 'factories' => [ |
23 | | - Application::class => function (ContainerInterface $container) { |
24 | | - return new Application($container->get(FastRouteRouter::class), $container); |
25 | | - }, |
26 | | - FastRouteRouter::class => function (ContainerInterface $container) { |
27 | | - return new FastRouteRouter(); |
28 | | - }, |
29 | | - |
30 | | - CommandBus::class => CommandBusFactory::class, |
31 | | - EventStore::class => EventStoreFactory::class, |
32 | | - Connection::class => ConnectionFactory::class, |
33 | | - |
34 | | - // @todo move commands/events to another config file |
35 | | - CreateConference::class => CreateConferenceHandlerFactory::class, |
36 | | - |
37 | | - // @todo move repository to another file |
38 | | - ConferenceRepositoryInterface::class => ConferenceRepositoryFactory::class, |
39 | | - |
40 | | - // @todo move db info to a class to get ENV vars |
41 | | - 'db_dsn' => function () { |
42 | | - return 'mysql:host=localhost;dbname=conticket'; |
43 | | - }, |
44 | | - 'db_user' => function () { |
45 | | - return 'root'; |
46 | | - }, |
47 | | - 'db_password' => function () { |
48 | | - return 'root'; |
49 | | - }, |
| 20 | + Application::class => ApplicationFactory::class, |
| 21 | + FastRouteRouter::class => InvokableFactory::class, |
| 22 | + CommandBus::class => CommandBusFactory::class, |
| 23 | + EventStore::class => EventStoreFactory::class, |
| 24 | + Connection::class => ConnectionFactory::class, |
| 25 | + \PDO::class => PDOFactory::class, |
50 | 26 | ], |
51 | 27 | ]; |
52 | 28 | })(); |
0 commit comments