3131use Api \User \Service \UserRoleServiceInterface ;
3232use Api \User \Service \UserService ;
3333use Api \User \Service \UserServiceInterface ;
34+ use Doctrine \ORM \Mapping \Driver \AttributeDriver ;
3435use Dot \DependencyInjection \Factory \AttributedRepositoryFactory ;
3536use Dot \DependencyInjection \Factory \AttributedServiceFactory ;
37+ use Mezzio \Application ;
3638use Mezzio \Hal \Metadata \MetadataMap ;
3739
3840class ConfigProvider
@@ -41,6 +43,7 @@ public function __invoke(): array
4143 {
4244 return [
4345 'dependencies ' => $ this ->getDependencies (),
46+ 'doctrine ' => $ this ->getDoctrineConfig (),
4447 MetadataMap::class => $ this ->getHalConfig (),
4548 'templates ' => $ this ->getTemplates (),
4649 ];
@@ -49,7 +52,12 @@ public function __invoke(): array
4952 public function getDependencies (): array
5053 {
5154 return [
52- 'factories ' => [
55+ 'delegators ' => [
56+ Application::class => [
57+ RoutesDelegator::class,
58+ ],
59+ ],
60+ 'factories ' => [
5361 AccountActivateHandler::class => AttributedServiceFactory::class,
5462 AccountAvatarHandler::class => AttributedServiceFactory::class,
5563 AccountHandler::class => AttributedServiceFactory::class,
@@ -69,14 +77,32 @@ public function getDependencies(): array
6977 UserRoleRepository::class => AttributedRepositoryFactory::class,
7078 UserAvatarRepository::class => AttributedRepositoryFactory::class,
7179 ],
72- 'aliases ' => [
80+ 'aliases ' => [
7381 UserAvatarServiceInterface::class => UserAvatarService::class,
7482 UserRoleServiceInterface::class => UserRoleService::class,
7583 UserServiceInterface::class => UserService::class,
7684 ],
7785 ];
7886 }
7987
88+ private function getDoctrineConfig (): array
89+ {
90+ return [
91+ 'driver ' => [
92+ 'orm_default ' => [
93+ 'drivers ' => [
94+ 'Api\User\Entity ' => 'UserEntities ' ,
95+ ],
96+ ],
97+ 'UserEntities ' => [
98+ 'class ' => AttributeDriver::class,
99+ 'cache ' => 'array ' ,
100+ 'paths ' => __DIR__ . '/Entity ' ,
101+ ],
102+ ],
103+ ];
104+ }
105+
80106 public function getHalConfig (): array
81107 {
82108 return [
0 commit comments