diff --git a/composer.json b/composer.json index 4e909e5e..3b8a744e 100644 --- a/composer.json +++ b/composer.json @@ -22,9 +22,9 @@ "zendframework/zend-config": "^3.0", "zendframework/zend-i18n": "^2.7", "zendframework/zend-config-aggregator": "^0.1", - "acelaya/zsm-annotated-services": "^1.0", "acelaya/ze-content-based-error-handler": "^2.0", "doctrine/orm": "^2.5", + "doctrine/annotations": "^1.4 <1.5", "doctrine/collections": "^1.4 <1.5", "doctrine/common": "^2.7 <2.8", "guzzlehttp/guzzle": "^6.2", diff --git a/module/Rest/config/dependencies.config.php b/module/Rest/config/dependencies.config.php index a36f7590..8f2227c0 100644 --- a/module/Rest/config/dependencies.config.php +++ b/module/Rest/config/dependencies.config.php @@ -1,34 +1,62 @@ [ 'factories' => [ - JWTService::class => AnnotatedFactory::class, - Service\ApiKeyService::class => AnnotatedFactory::class, + JWTService::class => ConfigAbstractFactory::class, + ApiKeyService::class => ConfigAbstractFactory::class, - Action\AuthenticateAction::class => AnnotatedFactory::class, - Action\CreateShortcodeAction::class => AnnotatedFactory::class, - Action\ResolveUrlAction::class => AnnotatedFactory::class, - Action\GetVisitsAction::class => AnnotatedFactory::class, - Action\ListShortcodesAction::class => AnnotatedFactory::class, - Action\EditShortcodeTagsAction::class => AnnotatedFactory::class, - Action\Tag\ListTagsAction::class => AnnotatedFactory::class, - Action\Tag\DeleteTagsAction::class => AnnotatedFactory::class, - Action\Tag\CreateTagsAction::class => AnnotatedFactory::class, - Action\Tag\UpdateTagAction::class => AnnotatedFactory::class, + Action\AuthenticateAction::class => ConfigAbstractFactory::class, + Action\CreateShortcodeAction::class => ConfigAbstractFactory::class, + Action\ResolveUrlAction::class => ConfigAbstractFactory::class, + Action\GetVisitsAction::class => ConfigAbstractFactory::class, + Action\ListShortcodesAction::class => ConfigAbstractFactory::class, + Action\EditShortcodeTagsAction::class => ConfigAbstractFactory::class, + Action\Tag\ListTagsAction::class => ConfigAbstractFactory::class, + Action\Tag\DeleteTagsAction::class => ConfigAbstractFactory::class, + Action\Tag\CreateTagsAction::class => ConfigAbstractFactory::class, + Action\Tag\UpdateTagAction::class => ConfigAbstractFactory::class, - Middleware\BodyParserMiddleware::class => AnnotatedFactory::class, + Middleware\BodyParserMiddleware::class => InvokableFactory::class, Middleware\CrossDomainMiddleware::class => InvokableFactory::class, Middleware\PathVersionMiddleware::class => InvokableFactory::class, - Middleware\CheckAuthenticationMiddleware::class => AnnotatedFactory::class, + Middleware\CheckAuthenticationMiddleware::class => ConfigAbstractFactory::class, ], ], + ConfigAbstractFactory::class => [ + JWTService::class => [AppOptions::class], + ApiKeyService::class => ['em'], + + Action\AuthenticateAction::class => [ApiKeyService::class, JWTService::class, 'translator', 'Logger_Shlink'], + Action\CreateShortcodeAction::class => [ + Service\UrlShortener::class, + 'translator', + 'config.url_shortener.domain', + 'Logger_Shlink' + ], + Action\ResolveUrlAction::class => [Service\UrlShortener::class, 'translator'], + Action\GetVisitsAction::class => [Service\VisitsTracker::class, 'translator', 'Logger_Shlink'], + Action\ListShortcodesAction::class => [Service\ShortUrlService::class, 'translator', 'Logger_Shlink'], + Action\EditShortcodeTagsAction::class => [Service\ShortUrlService::class, 'translator', 'Logger_Shlink'], + Action\Tag\ListTagsAction::class => [Service\Tag\TagService::class, LoggerInterface::class], + Action\Tag\DeleteTagsAction::class => [Service\Tag\TagService::class, LoggerInterface::class], + Action\Tag\CreateTagsAction::class => [Service\Tag\TagService::class, LoggerInterface::class], + Action\Tag\UpdateTagAction::class => [Service\Tag\TagService::class, Translator::class, LoggerInterface::class], + + Middleware\CheckAuthenticationMiddleware::class => [JWTService::class, 'translator', 'Logger_Shlink'], + ], + ]; diff --git a/module/Rest/src/Action/AuthenticateAction.php b/module/Rest/src/Action/AuthenticateAction.php index a4b15920..1403e88e 100644 --- a/module/Rest/src/Action/AuthenticateAction.php +++ b/module/Rest/src/Action/AuthenticateAction.php @@ -1,12 +1,10 @@ appOptions = $appOptions; diff --git a/module/Rest/src/Middleware/CheckAuthenticationMiddleware.php b/module/Rest/src/Middleware/CheckAuthenticationMiddleware.php index d7d922ad..93537d35 100644 --- a/module/Rest/src/Middleware/CheckAuthenticationMiddleware.php +++ b/module/Rest/src/Middleware/CheckAuthenticationMiddleware.php @@ -1,7 +1,6 @@ em = $em;