@@ -43,8 +43,8 @@ |
||
43 | 43 | public function toArray(): array |
44 | 44 | { |
45 | 45 | return [ |
46 | - 'tenant' => $this->tenantId, |
|
47 | - 'content' => $this->content, |
|
46 | + 'tenant' => $this->tenantId, |
|
47 | + 'content' => $this->content, |
|
48 | 48 | ]; |
49 | 49 | } |
50 | 50 | } |
@@ -39,7 +39,7 @@ |
||
39 | 39 | /** |
40 | 40 | * @param Schema $schema |
41 | 41 | */ |
42 | - public function postUp(Schema $schema) : void |
|
42 | + public function postUp(Schema $schema) : void |
|
43 | 43 | { |
44 | 44 | $entityManager = $this->container->get('doctrine.orm.default_entity_manager'); |
45 | 45 | $query = $entityManager |
@@ -39,7 +39,7 @@ |
||
39 | 39 | /** |
40 | 40 | * @param Schema $schema |
41 | 41 | */ |
42 | - public function postUp(Schema $schema) : void |
|
42 | + public function postUp(Schema $schema) : void |
|
43 | 43 | { |
44 | 44 | $entityManager = $this->container->get('doctrine.orm.default_entity_manager'); |
45 | 45 | $query = $entityManager |
@@ -39,7 +39,7 @@ |
||
39 | 39 | /** |
40 | 40 | * @param Schema $schema |
41 | 41 | */ |
42 | - public function postUp(Schema $schema) : void |
|
42 | + public function postUp(Schema $schema) : void |
|
43 | 43 | { |
44 | 44 | $entityManager = $this->container->get('doctrine.orm.default_entity_manager'); |
45 | 45 | $query = $entityManager |
@@ -32,27 +32,27 @@ discard block |
||
32 | 32 | |
33 | 33 | class PackageSearchController extends AbstractController { |
34 | 34 | |
35 | - private PaginatorInterface $paginator; |
|
36 | - private EventDispatcherInterface $eventDispatcher; |
|
37 | - private CachedTenantContext $cachedTenantContext; |
|
35 | + private PaginatorInterface $paginator; |
|
36 | + private EventDispatcherInterface $eventDispatcher; |
|
37 | + private CachedTenantContext $cachedTenantContext; |
|
38 | 38 | |
39 | - /** |
|
40 | - * @param PaginatorInterface $paginator |
|
41 | - * @param EventDispatcherInterface $eventDispatcher |
|
42 | - * @param CachedTenantContext $cachedTenantContext |
|
43 | - */ |
|
44 | - public function __construct(PaginatorInterface $paginator, EventDispatcherInterface $eventDispatcher, |
|
45 | - CachedTenantContext $cachedTenantContext) { |
|
39 | + /** |
|
40 | + * @param PaginatorInterface $paginator |
|
41 | + * @param EventDispatcherInterface $eventDispatcher |
|
42 | + * @param CachedTenantContext $cachedTenantContext |
|
43 | + */ |
|
44 | + public function __construct(PaginatorInterface $paginator, EventDispatcherInterface $eventDispatcher, |
|
45 | + CachedTenantContext $cachedTenantContext) { |
|
46 | 46 | $this->paginator = $paginator; |
47 | 47 | $this->eventDispatcher = $eventDispatcher; |
48 | 48 | $this->cachedTenantContext = $cachedTenantContext; |
49 | - } |
|
49 | + } |
|
50 | 50 | |
51 | 51 | |
52 | - /** |
|
53 | - * @Route("/api/{version}/packages/", methods={"GET"}, options={"expose"=true}, defaults={"version"="v2"}, name="swp_api_core_list_packages") |
|
54 | - */ |
|
55 | - public function searchAction(Request $request, RepositoryManagerInterface $repositoryManager) { |
|
52 | + /** |
|
53 | + * @Route("/api/{version}/packages/", methods={"GET"}, options={"expose"=true}, defaults={"version"="v2"}, name="swp_api_core_list_packages") |
|
54 | + */ |
|
55 | + public function searchAction(Request $request, RepositoryManagerInterface $repositoryManager) { |
|
56 | 56 | $this->eventDispatcher->dispatch( new GenericEvent(), MultiTenancyEvents::TENANTABLE_DISABLE); |
57 | 57 | $currentTenant = $this->cachedTenantContext->getTenant(); |
58 | 58 | |
@@ -106,5 +106,5 @@ discard block |
||
106 | 106 | ); |
107 | 107 | |
108 | 108 | return new ResourcesListResponse($pagination, $responseContext); |
109 | - } |
|
109 | + } |
|
110 | 110 | } |
@@ -28,24 +28,24 @@ discard block |
||
28 | 28 | |
29 | 29 | class SubscriptionController extends Controller { |
30 | 30 | |
31 | - private SubscriptionsProviderInterface $subscriptionsProvider; |
|
32 | - private RepositoryInterface $userRepository; |
|
33 | - |
|
34 | - /** |
|
35 | - * @param SubscriptionsProviderInterface $subscriptionsProvider |
|
36 | - * @param RepositoryInterface $userRepository |
|
37 | - */ |
|
38 | - public function __construct(SubscriptionsProviderInterface $subscriptionsProvider, |
|
39 | - RepositoryInterface $userRepository) { |
|
31 | + private SubscriptionsProviderInterface $subscriptionsProvider; |
|
32 | + private RepositoryInterface $userRepository; |
|
33 | + |
|
34 | + /** |
|
35 | + * @param SubscriptionsProviderInterface $subscriptionsProvider |
|
36 | + * @param RepositoryInterface $userRepository |
|
37 | + */ |
|
38 | + public function __construct(SubscriptionsProviderInterface $subscriptionsProvider, |
|
39 | + RepositoryInterface $userRepository) { |
|
40 | 40 | $this->subscriptionsProvider = $subscriptionsProvider; |
41 | 41 | $this->userRepository = $userRepository; |
42 | - } |
|
42 | + } |
|
43 | 43 | |
44 | 44 | |
45 | - /** |
|
46 | - * @Route("/api/{version}/subscriptions/{userId}", options={"expose"=true}, defaults={"version"="v2"}, methods={"GET"}, name="swp_api_paywall_list_subscriptions", requirements={"id"="\d+"}) |
|
47 | - */ |
|
48 | - public function getAction(Request $request, int $userId) { |
|
45 | + /** |
|
46 | + * @Route("/api/{version}/subscriptions/{userId}", options={"expose"=true}, defaults={"version"="v2"}, methods={"GET"}, name="swp_api_paywall_list_subscriptions", requirements={"id"="\d+"}) |
|
47 | + */ |
|
48 | + public function getAction(Request $request, int $userId) { |
|
49 | 49 | $subscriptionsProvider = $this->subscriptionsProvider; |
50 | 50 | |
51 | 51 | $filters = [ |
@@ -58,15 +58,15 @@ discard block |
||
58 | 58 | $subscriptions = $subscriptionsProvider->getSubscriptions($user, $filters); |
59 | 59 | |
60 | 60 | return new SingleResourceResponse($subscriptions); |
61 | - } |
|
61 | + } |
|
62 | 62 | |
63 | - private function findOr404(int $id) { |
|
63 | + private function findOr404(int $id) { |
|
64 | 64 | $user = $this->userRepository->findOneById($id); |
65 | 65 | |
66 | 66 | if (!$user instanceof UserInterface) { |
67 | - throw new NotFoundHttpException(sprintf('User with id "%s" was not found.', $id)); |
|
67 | + throw new NotFoundHttpException(sprintf('User with id "%s" was not found.', $id)); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | return $user; |
71 | - } |
|
71 | + } |
|
72 | 72 | } |
@@ -29,40 +29,40 @@ discard block |
||
29 | 29 | |
30 | 30 | class ExternalDataController extends AbstractController { |
31 | 31 | |
32 | - private PackageRepositoryInterface $packageRepository; |
|
33 | - private FactoryInterface $factory; |
|
34 | - |
|
35 | - /** |
|
36 | - * @param PackageRepositoryInterface $packageRepository |
|
37 | - * @param FactoryInterface $factory |
|
38 | - */ |
|
39 | - public function __construct(PackageRepositoryInterface $packageRepository, FactoryInterface $factory) { |
|
32 | + private PackageRepositoryInterface $packageRepository; |
|
33 | + private FactoryInterface $factory; |
|
34 | + |
|
35 | + /** |
|
36 | + * @param PackageRepositoryInterface $packageRepository |
|
37 | + * @param FactoryInterface $factory |
|
38 | + */ |
|
39 | + public function __construct(PackageRepositoryInterface $packageRepository, FactoryInterface $factory) { |
|
40 | 40 | $this->packageRepository = $packageRepository; |
41 | 41 | $this->factory = $factory; |
42 | - } |
|
42 | + } |
|
43 | 43 | |
44 | - /** |
|
45 | - * @Route("/api/{version}/packages/extra/{slug}", options={"expose"=true}, defaults={"version"="v2"}, methods={"PUT"}, name="swp_api_core_add_extra_data") |
|
46 | - */ |
|
47 | - public function setAction(Request $request, string $slug): SingleResourceResponseInterface { |
|
44 | + /** |
|
45 | + * @Route("/api/{version}/packages/extra/{slug}", options={"expose"=true}, defaults={"version"="v2"}, methods={"PUT"}, name="swp_api_core_add_extra_data") |
|
46 | + */ |
|
47 | + public function setAction(Request $request, string $slug): SingleResourceResponseInterface { |
|
48 | 48 | $packageRepository = $this->packageRepository; |
49 | 49 | $existingPackage = $packageRepository->findOneBy(['slugline' => $slug]); |
50 | 50 | if (null === $existingPackage) { |
51 | - throw new NotFoundHttpException(sprintf('Package with slug %s was not found', $slug)); |
|
51 | + throw new NotFoundHttpException(sprintf('Package with slug %s was not found', $slug)); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | $externalData = $existingPackage->getExternalData(); |
55 | 55 | if (null === $externalData) { |
56 | - foreach ($externalData as $data) { |
|
56 | + foreach ($externalData as $data) { |
|
57 | 57 | $packageRepository->remove($data); |
58 | - } |
|
59 | - $packageRepository->flush(); |
|
58 | + } |
|
59 | + $packageRepository->flush(); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | if (null !== $request->getContent()) { |
63 | - $validJson = self::getArrayFromJson($request->getContent()); |
|
64 | - $responseData = []; |
|
65 | - foreach ($validJson as $key => $value) { |
|
63 | + $validJson = self::getArrayFromJson($request->getContent()); |
|
64 | + $responseData = []; |
|
65 | + foreach ($validJson as $key => $value) { |
|
66 | 66 | /** @var ExternalDataInterface $externalData */ |
67 | 67 | $externalData = $this->factory->create(); |
68 | 68 | $externalData->setKey($key); |
@@ -70,45 +70,45 @@ discard block |
||
70 | 70 | $externalData->setPackage($existingPackage); |
71 | 71 | $packageRepository->persist($externalData); |
72 | 72 | $responseData[$externalData->getKey()] = $externalData->getValue(); |
73 | - } |
|
74 | - $packageRepository->flush(); |
|
73 | + } |
|
74 | + $packageRepository->flush(); |
|
75 | 75 | |
76 | - return new SingleResourceResponse($responseData, new ResponseContext(200)); |
|
76 | + return new SingleResourceResponse($responseData, new ResponseContext(200)); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | return new SingleResourceResponse(['Provided request content is not valid JSON'], new ResponseContext(400)); |
80 | - } |
|
80 | + } |
|
81 | 81 | |
82 | - /** |
|
83 | - * @Route("/api/{version}/packages/extra/{slug}", options={"expose"=true}, defaults={"version"="v2"}, methods={"GET"}, name="swp_api_core_get_extra_data") |
|
84 | - */ |
|
85 | - public function getAction(string $slug): SingleResourceResponseInterface { |
|
82 | + /** |
|
83 | + * @Route("/api/{version}/packages/extra/{slug}", options={"expose"=true}, defaults={"version"="v2"}, methods={"GET"}, name="swp_api_core_get_extra_data") |
|
84 | + */ |
|
85 | + public function getAction(string $slug): SingleResourceResponseInterface { |
|
86 | 86 | $packageRepository = $this->packageRepository; |
87 | 87 | $existingPackage = $packageRepository->findOneBy(['slugline' => $slug]); |
88 | 88 | if (null === $existingPackage) { |
89 | - throw new NotFoundHttpException(sprintf('package with slug %s was not found', $slug)); |
|
89 | + throw new NotFoundHttpException(sprintf('package with slug %s was not found', $slug)); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | $externalData = $existingPackage->getExternalData(); |
93 | 93 | if (null === $externalData) { |
94 | - return new SingleResourceResponse([], new ResponseContext(200)); |
|
94 | + return new SingleResourceResponse([], new ResponseContext(200)); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | $responseData = []; |
98 | 98 | /** @var ExternalDataInterface $data */ |
99 | 99 | foreach ($externalData as $data) { |
100 | - $responseData[$data->getKey()] = $data->getValue(); |
|
100 | + $responseData[$data->getKey()] = $data->getValue(); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | return new SingleResourceResponse($responseData, new ResponseContext(200)); |
104 | - } |
|
104 | + } |
|
105 | 105 | |
106 | - private static function getArrayFromJson($jsonString) { |
|
106 | + private static function getArrayFromJson($jsonString) { |
|
107 | 107 | $jsonArray = json_decode($jsonString, true); |
108 | 108 | if (null === $jsonArray || JSON_ERROR_NONE !== json_last_error()) { |
109 | - throw new \UnexpectedValueException('Provided request content is not valid JSON'); |
|
109 | + throw new \UnexpectedValueException('Provided request content is not valid JSON'); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | return $jsonArray; |
113 | - } |
|
113 | + } |
|
114 | 114 | } |
@@ -37,45 +37,45 @@ discard block |
||
37 | 37 | |
38 | 38 | class RedirectRouteController extends AbstractController { |
39 | 39 | |
40 | - private FormFactoryInterface $formFactory; |
|
41 | - private RepositoryInterface $redirectRouteRepository; |
|
42 | - private EntityManagerInterface $entityManager; |
|
43 | - private FactoryInterface $redirectRouteFactory; |
|
44 | - private EventDispatcherInterface $eventDispatcher; |
|
45 | - |
|
46 | - /** |
|
47 | - * @param FormFactoryInterface $formFactory |
|
48 | - * @param RepositoryInterface $redirectRouteRepository |
|
49 | - * @param EntityManagerInterface $entityManager |
|
50 | - * @param FactoryInterface $redirectRouteFactory |
|
51 | - * @param EventDispatcherInterface $eventDispatcher |
|
52 | - */ |
|
53 | - public function __construct(FormFactoryInterface $formFactory, RepositoryInterface $redirectRouteRepository, |
|
54 | - EntityManagerInterface $entityManager, FactoryInterface $redirectRouteFactory, |
|
55 | - EventDispatcherInterface $eventDispatcher) { |
|
40 | + private FormFactoryInterface $formFactory; |
|
41 | + private RepositoryInterface $redirectRouteRepository; |
|
42 | + private EntityManagerInterface $entityManager; |
|
43 | + private FactoryInterface $redirectRouteFactory; |
|
44 | + private EventDispatcherInterface $eventDispatcher; |
|
45 | + |
|
46 | + /** |
|
47 | + * @param FormFactoryInterface $formFactory |
|
48 | + * @param RepositoryInterface $redirectRouteRepository |
|
49 | + * @param EntityManagerInterface $entityManager |
|
50 | + * @param FactoryInterface $redirectRouteFactory |
|
51 | + * @param EventDispatcherInterface $eventDispatcher |
|
52 | + */ |
|
53 | + public function __construct(FormFactoryInterface $formFactory, RepositoryInterface $redirectRouteRepository, |
|
54 | + EntityManagerInterface $entityManager, FactoryInterface $redirectRouteFactory, |
|
55 | + EventDispatcherInterface $eventDispatcher) { |
|
56 | 56 | $this->formFactory = $formFactory; |
57 | 57 | $this->redirectRouteRepository = $redirectRouteRepository; |
58 | 58 | $this->entityManager = $entityManager; |
59 | 59 | $this->redirectRouteFactory = $redirectRouteFactory; |
60 | 60 | $this->eventDispatcher = $eventDispatcher; |
61 | - } |
|
61 | + } |
|
62 | 62 | |
63 | 63 | |
64 | - /** |
|
65 | - * @Route("/api/{version}/redirects/", methods={"GET"}, options={"expose"=true}, defaults={"version"="v2"}, name="swp_api_core_list_redirect_routes") |
|
66 | - */ |
|
67 | - public function listAction(Request $request) { |
|
64 | + /** |
|
65 | + * @Route("/api/{version}/redirects/", methods={"GET"}, options={"expose"=true}, defaults={"version"="v2"}, name="swp_api_core_list_redirect_routes") |
|
66 | + */ |
|
67 | + public function listAction(Request $request) { |
|
68 | 68 | $redirectRouteRepository = $this->redirectRouteRepository; |
69 | 69 | |
70 | 70 | $redirectRoutes = $redirectRouteRepository->getPaginatedByCriteria($this->eventDispatcher, new Criteria(), $request->query->all('sorting'), new PaginationData($request)); |
71 | 71 | |
72 | 72 | return new ResourcesListResponse($redirectRoutes); |
73 | - } |
|
73 | + } |
|
74 | 74 | |
75 | - /** |
|
76 | - * @Route("/api/{version}/redirects/{id}", methods={"DELETE"}, options={"expose"=true}, defaults={"version"="v2"}, name="swp_api_core_delete_redirect_route", requirements={"id"="\d+"}) |
|
77 | - */ |
|
78 | - public function deleteAction(int $id): SingleResourceResponseInterface { |
|
75 | + /** |
|
76 | + * @Route("/api/{version}/redirects/{id}", methods={"DELETE"}, options={"expose"=true}, defaults={"version"="v2"}, name="swp_api_core_delete_redirect_route", requirements={"id"="\d+"}) |
|
77 | + */ |
|
78 | + public function deleteAction(int $id): SingleResourceResponseInterface { |
|
79 | 79 | $objectManager = $this->entityManager; |
80 | 80 | $redirectRoute = $this->findOr404($id); |
81 | 81 | |
@@ -83,69 +83,69 @@ discard block |
||
83 | 83 | $objectManager->flush(); |
84 | 84 | |
85 | 85 | return new SingleResourceResponse(null, new ResponseContext(204)); |
86 | - } |
|
86 | + } |
|
87 | 87 | |
88 | - /** |
|
89 | - * @Route("/api/{version}/redirects/", methods={"POST"}, options={"expose"=true}, defaults={"version"="v2"}, name="swp_api_core_create_redirect_route") |
|
90 | - */ |
|
91 | - public function createAction(Request $request): SingleResourceResponseInterface { |
|
88 | + /** |
|
89 | + * @Route("/api/{version}/redirects/", methods={"POST"}, options={"expose"=true}, defaults={"version"="v2"}, name="swp_api_core_create_redirect_route") |
|
90 | + */ |
|
91 | + public function createAction(Request $request): SingleResourceResponseInterface { |
|
92 | 92 | $redirectRoute = $this->redirectRouteFactory->create(); |
93 | 93 | $form = $this->formFactory->createNamed('', RedirectRouteType::class, $redirectRoute, ['method' => $request->getMethod()]); |
94 | 94 | |
95 | 95 | $form->handleRequest($request); |
96 | 96 | |
97 | 97 | if ($this->checkIfSourceRouteExists($redirectRoute)) { |
98 | - $this->ensureRedirectRouteExists($redirectRoute->getRouteName()); |
|
98 | + $this->ensureRedirectRouteExists($redirectRoute->getRouteName()); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | if ($form->isSubmitted() && $form->isValid()) { |
102 | - if ($this->checkIfSourceRouteExists($redirectRoute)) { |
|
102 | + if ($this->checkIfSourceRouteExists($redirectRoute)) { |
|
103 | 103 | $redirectRoute->setStaticPrefix($redirectRoute->getRouteName()); |
104 | - } else { |
|
104 | + } else { |
|
105 | 105 | $redirectRoute->setStaticPrefix($redirectRoute->getRouteSource()->getStaticPrefix()); |
106 | - } |
|
106 | + } |
|
107 | 107 | |
108 | - $this->redirectRouteRepository->add($redirectRoute); |
|
108 | + $this->redirectRouteRepository->add($redirectRoute); |
|
109 | 109 | |
110 | - return new SingleResourceResponse($redirectRoute, new ResponseContext(201)); |
|
110 | + return new SingleResourceResponse($redirectRoute, new ResponseContext(201)); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | return new SingleResourceResponse($form, new ResponseContext(400)); |
114 | - } |
|
114 | + } |
|
115 | 115 | |
116 | - /** |
|
117 | - * @Route("/api/{version}/redirects/{id}", methods={"PATCH"}, options={"expose"=true}, defaults={"version"="v2"}, name="swp_api_core_update_redirect_route", requirements={"id"="\d+"}) |
|
118 | - */ |
|
119 | - public function updateAction(Request $request, int $id): SingleResourceResponseInterface { |
|
116 | + /** |
|
117 | + * @Route("/api/{version}/redirects/{id}", methods={"PATCH"}, options={"expose"=true}, defaults={"version"="v2"}, name="swp_api_core_update_redirect_route", requirements={"id"="\d+"}) |
|
118 | + */ |
|
119 | + public function updateAction(Request $request, int $id): SingleResourceResponseInterface { |
|
120 | 120 | $objectManager = $this->entityManager; |
121 | 121 | $redirectRoute = $this->findOr404($id); |
122 | 122 | $form = $this->formFactory->createNamed('', RedirectRouteType::class, $redirectRoute, ['method' => $request->getMethod()]); |
123 | 123 | $form->handleRequest($request); |
124 | 124 | |
125 | 125 | if ($form->isSubmitted() && $form->isValid()) { |
126 | - $objectManager->flush(); |
|
126 | + $objectManager->flush(); |
|
127 | 127 | |
128 | - return new SingleResourceResponse($redirectRoute, new ResponseContext(200)); |
|
128 | + return new SingleResourceResponse($redirectRoute, new ResponseContext(200)); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | return new SingleResourceResponse($form, new ResponseContext(400)); |
132 | - } |
|
132 | + } |
|
133 | 133 | |
134 | - private function findOr404(int $id): RedirectRouteInterface { |
|
134 | + private function findOr404(int $id): RedirectRouteInterface { |
|
135 | 135 | if (null === $redirectRoute = $this->redirectRouteRepository->findOneById($id)) { |
136 | - throw new NotFoundHttpException('Redirect route was not found.'); |
|
136 | + throw new NotFoundHttpException('Redirect route was not found.'); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | return $redirectRoute; |
140 | - } |
|
140 | + } |
|
141 | 141 | |
142 | - private function ensureRedirectRouteExists(?string $name): void { |
|
142 | + private function ensureRedirectRouteExists(?string $name): void { |
|
143 | 143 | if (null !== $this->redirectRouteRepository->findOneBy(['routeName' => $name])) { |
144 | - throw new ConflictHttpException(sprintf('Redirect route "%s" already exists!', $name)); |
|
144 | + throw new ConflictHttpException(sprintf('Redirect route "%s" already exists!', $name)); |
|
145 | + } |
|
145 | 146 | } |
146 | - } |
|
147 | 147 | |
148 | - private function checkIfSourceRouteExists(RedirectRouteInterface $redirectRoute): bool { |
|
148 | + private function checkIfSourceRouteExists(RedirectRouteInterface $redirectRoute): bool { |
|
149 | 149 | return null === $redirectRoute->getRouteSource(); |
150 | - } |
|
150 | + } |
|
151 | 151 | } |
@@ -28,22 +28,22 @@ discard block |
||
28 | 28 | |
29 | 29 | class ArticleSourceController extends AbstractController { |
30 | 30 | |
31 | - private EntityRepository $entityRepository; |
|
32 | - private EventDispatcherInterface $eventDispatcher; |
|
33 | - |
|
34 | - /** |
|
35 | - * @param EntityRepository $entityRepository |
|
36 | - * @param EventDispatcherInterface $eventDispatcher |
|
37 | - */ |
|
38 | - public function __construct(EntityRepository $entityRepository, EventDispatcherInterface $eventDispatcher) { |
|
31 | + private EntityRepository $entityRepository; |
|
32 | + private EventDispatcherInterface $eventDispatcher; |
|
33 | + |
|
34 | + /** |
|
35 | + * @param EntityRepository $entityRepository |
|
36 | + * @param EventDispatcherInterface $eventDispatcher |
|
37 | + */ |
|
38 | + public function __construct(EntityRepository $entityRepository, EventDispatcherInterface $eventDispatcher) { |
|
39 | 39 | $this->entityRepository = $entityRepository; |
40 | 40 | $this->eventDispatcher = $eventDispatcher; |
41 | - } |
|
41 | + } |
|
42 | 42 | |
43 | - /** |
|
44 | - * @Route("/api/{version}/content/sources/", options={"expose"=true}, defaults={"version"="v2"}, methods={"GET"}, name="swp_api_core_article_sources") |
|
45 | - */ |
|
46 | - public function listAction(Request $request): ResourcesListResponseInterface { |
|
43 | + /** |
|
44 | + * @Route("/api/{version}/content/sources/", options={"expose"=true}, defaults={"version"="v2"}, methods={"GET"}, name="swp_api_core_article_sources") |
|
45 | + */ |
|
46 | + public function listAction(Request $request): ResourcesListResponseInterface { |
|
47 | 47 | $sorting = $request->query->all('sorting'); |
48 | 48 | $lists = $this->entityRepository->getPaginatedByCriteria( |
49 | 49 | $this->eventDispatcher, |
@@ -52,5 +52,5 @@ discard block |
||
52 | 52 | new PaginationData($request)); |
53 | 53 | |
54 | 54 | return new ResourcesListResponse($lists); |
55 | - } |
|
55 | + } |
|
56 | 56 | } |