diff --git a/UPGRADE-5.9.md b/UPGRADE-5.9.md index 875833151c..a3c57cdfb6 100644 --- a/UPGRADE-5.9.md +++ b/UPGRADE-5.9.md @@ -12,6 +12,66 @@ General * The abandoned package `fzaninotto/faker` is replaced with the `fakerphp/faker` package. If you use the abandoned package in your project, replace it with `fakerphp/faker` to allow upgrading to v5.9. +### Controllers + +Controllers are changing their base class in 6.0 so there a specific changes applied to a set of controllers + +#### Final + +These controllers are marked as final and will be registered as services in 6.0. + +* Kunstmaan\AdminBundle\Controller\DefaultController +* Kunstmaan\AdminBundle\Controller\ExceptionController +* Kunstmaan\AdminBundle\Controller\ModulesController +* Kunstmaan\AdminBundle\Controller\SettingsController +* Kunstmaan\AdminListBundle\Controller\EntityLockCheckController +* Kunstmaan\CacheBundle\Controller\VarnishController +* Kunstmaan\ConfigBundle\Controller\ConfigController +* Kunstmaan\DashboardBundle\Controller\DashboardController +* Kunstmaan\DashboardBundle\Controller\GoogleAnalyticsAJAXController +* Kunstmaan\DashboardBundle\Controller\GoogleAnalyticsController +* Kunstmaan\FormBundle\Controller\FormSubmissionsController +* Kunstmaan\LeadGenerationBundle\Controller\PopupsAdminListController +* Kunstmaan\LeadGenerationBundle\Controller\RulesAdminListController +* Kunstmaan\MediaBundle\Controller\ChooserController +* Kunstmaan\MediaBundle\Controller\FolderController +* Kunstmaan\MediaBundle\Controller\IconFontController +* Kunstmaan\MediaBundle\Controller\MediaController +* Kunstmaan\MenuBundle\Controller\MenuAdminListController +* Kunstmaan\MenuBundle\Controller\MenuItemAdminListController +* Kunstmaan\MultiDomainBundle\Controller\SiteSwitchController +* Kunstmaan\NodeBundle\Controller\NodeAdminController +* Kunstmaan\NodeBundle\Controller\SlugController +* Kunstmaan\NodeBundle\Controller\UrlReplaceController +* Kunstmaan\NodeBundle\Controller\WidgetsController +* Kunstmaan\PagePartBundle\Controller\PagePartAdminController +* Kunstmaan\RedirectBundle\Controller\RedirectAdminListController +* Kunstmaan\SeoBundle\Controller\Admin\SettingsController +* Kunstmaan\SeoBundle\Controller\RobotsController +* Kunstmaan\SitemapBundle\Controller\SitemapController +* Kunstmaan\TaggingBundle\Controller\TagAdminListController +* Kunstmaan\TranslatorBundle\Controller\TranslatorCommandController +* Kunstmaan\TranslatorBundle\Controller\TranslatorController +* Kunstmaan\UserManagementBundle\Controller\GroupsController +* Kunstmaan\UserManagementBundle\Controller\RolesController +* Kunstmaan\UserManagementBundle\Controller\UsersController +* Kunstmaan\VotingBundle\Controller\VotingController + +#### Deprecated + +* Kunstmaan\AdminBundle\Controller\BaseSettingsController is deprecated with no replacement. +* Kunstmaan\AdminListBundle\Controller\AdminListController is deprecated and replaced by `Kunstmaan\AdminListBundle\Controller\AbstractAdminListController`. There are + no changes in available methods except that the class now extends from `Symfony\Bundle\FrameworkBundle\Controller\AbstractController`. + If you use symfony 3.4 make sure to register the controller extending `Kunstmaan\AdminListBundle\Controller\AbstractAdminListController` as a service and add the `container.service_subscriber` tag. + +#### Base class switched to AbstractController + +These controllers will switch their base class to `Symfony\Bundle\FrameworkBundle\Controller\AbstractController`, inject +services you need in your controllers and make sure the controllers are registered as services. + +* Kunstmaan\LeadGenerationBundle\Controller\AbstractNewsletterController +* Kunstmaan\LeadGenerationBundle\Controller\AbstractRedirectController + AdminBundle ------------ diff --git a/src/Kunstmaan/AdminBundle/Controller/BaseSettingsController.php b/src/Kunstmaan/AdminBundle/Controller/BaseSettingsController.php index 380b8c9758..e90db4eeac 100644 --- a/src/Kunstmaan/AdminBundle/Controller/BaseSettingsController.php +++ b/src/Kunstmaan/AdminBundle/Controller/BaseSettingsController.php @@ -4,6 +4,9 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller; +/** + * @deprecated since KunstmaanAdminBundle 5.9 and will be removed in KunstmaanAdminBundle 6.0. + */ class BaseSettingsController extends Controller { } diff --git a/src/Kunstmaan/AdminBundle/Controller/DefaultController.php b/src/Kunstmaan/AdminBundle/Controller/DefaultController.php index f3b7412f81..279529ca13 100644 --- a/src/Kunstmaan/AdminBundle/Controller/DefaultController.php +++ b/src/Kunstmaan/AdminBundle/Controller/DefaultController.php @@ -14,6 +14,8 @@ /** * The default controller is used to render the main screen the users see when they log in to the admin + * + * @final since 5.9 */ class DefaultController extends Controller { diff --git a/src/Kunstmaan/AdminBundle/Controller/ExceptionController.php b/src/Kunstmaan/AdminBundle/Controller/ExceptionController.php index 5fc1c0d9f9..9d8227b062 100644 --- a/src/Kunstmaan/AdminBundle/Controller/ExceptionController.php +++ b/src/Kunstmaan/AdminBundle/Controller/ExceptionController.php @@ -10,6 +10,9 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\Annotation\Route; +/** + * @final since 5.9 + */ class ExceptionController extends AdminListController { /** @var ExceptionAdminListConfigurator */ diff --git a/src/Kunstmaan/AdminBundle/Controller/ModulesController.php b/src/Kunstmaan/AdminBundle/Controller/ModulesController.php index 0631e91ba2..28a992de32 100644 --- a/src/Kunstmaan/AdminBundle/Controller/ModulesController.php +++ b/src/Kunstmaan/AdminBundle/Controller/ModulesController.php @@ -8,6 +8,8 @@ /** * The modules home controller + * + * @final since 5.9 */ class ModulesController extends Controller { diff --git a/src/Kunstmaan/AdminBundle/Controller/SettingsController.php b/src/Kunstmaan/AdminBundle/Controller/SettingsController.php index bf41ef8b43..e91984f332 100644 --- a/src/Kunstmaan/AdminBundle/Controller/SettingsController.php +++ b/src/Kunstmaan/AdminBundle/Controller/SettingsController.php @@ -8,6 +8,8 @@ /** * Main settings controller + * + * @final since 5.9 */ class SettingsController extends BaseSettingsController { diff --git a/src/Kunstmaan/AdminListBundle/Controller/AbstractAdminListController.php b/src/Kunstmaan/AdminListBundle/Controller/AbstractAdminListController.php new file mode 100644 index 0000000000..7d53cdd5a7 --- /dev/null +++ b/src/Kunstmaan/AdminListBundle/Controller/AbstractAdminListController.php @@ -0,0 +1,586 @@ +getDoctrine()->getManager(); + } + + /** + * Shows the list of entities + * + * @param Request|null $request + * + * @return Response + */ + protected function doIndexAction(AbstractAdminListConfigurator $configurator, Request $request) + { + /* @var AdminList $adminList */ + $adminList = $this->container->get('kunstmaan_adminlist.factory')->createList($configurator); + $adminList->bindRequest($request); + + $this->buildSortableFieldActions($configurator); + + return new Response( + $this->renderView( + $configurator->getListTemplate(), + ['adminlist' => $adminList, 'adminlistconfigurator' => $configurator, 'addparams' => []] + ) + ); + } + + /** + * Export a list of Entities + * + * @param AbstractAdminListConfigurator $configurator The adminlist configurator + * @param string $_format The format to export to + * + * @throws AccessDeniedHttpException + * + * @return Response + */ + protected function doExportAction(AbstractAdminListConfigurator $configurator, $_format, Request $request = null) + { + if (!$configurator->canExport()) { + throw $this->createAccessDeniedException('You do not have sufficient rights to access this page.'); + } + + /* @var AdminList $adminList */ + $adminList = $this->container->get('kunstmaan_adminlist.factory')->createExportList($configurator); + $adminList->bindRequest($request); + + return $this->container->get('kunstmaan_adminlist.service.export')->getDownloadableResponse($adminList, $_format); + } + + /** + * Creates and processes the form to add a new Entity + * + * @param AbstractAdminListConfigurator $configurator The adminlist configurator + * @param string $type The type to add + * @param Request|null $request + * + * @throws AccessDeniedHttpException + * + * @return Response + */ + protected function doAddAction(AbstractAdminListConfigurator $configurator, $type = null, Request $request) + { + if (!$configurator->canAdd()) { + throw $this->createAccessDeniedException('You do not have sufficient rights to access this page.'); + } + + /* @var EntityManager $em */ + $em = $this->getEntityManager(); + $entityName = isset($type) ? $type : $configurator->getRepositoryName(); + + $classMetaData = $em->getClassMetadata($entityName); + // Creates a new instance of the mapped class, without invoking the constructor. + $classname = $classMetaData->getName(); + $helper = new $classname(); + $helper = $configurator->decorateNewEntity($helper); + + $formType = $configurator->getAdminType($helper); + + $event = new AdaptSimpleFormEvent($request, $formType, $helper, $configurator->getAdminTypeOptions()); + $event = $this->dispatch($event, Events::ADAPT_SIMPLE_FORM); + $tabPane = $event->getTabPane(); + + $form = $this->createForm($formType, $helper, $event->getOptions()); + + if ($request->isMethod('POST')) { + if ($tabPane) { + $tabPane->bindRequest($request); + $form = $tabPane->getForm(); + } else { + $form->handleRequest($request); + } + + // Don't redirect to listing when coming from ajax request, needed for url chooser. + if ($form->isSubmitted() && $form->isValid() && !$request->isXmlHttpRequest()) { + $adminListEvent = new AdminListEvent($helper, $request, $form); + $this->dispatch( + $adminListEvent, + AdminListEvents::PRE_ADD + ); + + // Check if Response is given + if ($adminListEvent->getResponse() instanceof Response) { + return $adminListEvent->getResponse(); + } + + // Set sort weight + $helper = $this->setSortWeightOnNewItem($configurator, $helper); + + $em->persist($helper); + $em->flush(); + $this->dispatch( + $adminListEvent, + AdminListEvents::POST_ADD + ); + + // Check if Response is given + if ($adminListEvent->getResponse() instanceof Response) { + return $adminListEvent->getResponse(); + } + + $indexUrl = $configurator->getIndexUrl(); + + return new RedirectResponse( + $this->generateUrl($indexUrl['path'], isset($indexUrl['params']) ? $indexUrl['params'] : []) + ); + } + } + + $params = [ + 'form' => $form->createView(), + 'adminlistconfigurator' => $configurator, + 'entityVersionLockCheck' => false, + 'entity' => $helper, + ]; + + if ($tabPane) { + $params = array_merge($params, ['tabPane' => $tabPane]); + } + + return new Response( + $this->renderView($configurator->getAddTemplate(), $params) + ); + } + + /** + * Creates and processes the edit form for an Entity using its ID + * + * @param AbstractAdminListConfigurator $configurator The adminlist configurator + * @param string $entityId The id of the entity that will be edited + * @param Request|null $request + * + * @throws NotFoundHttpException + * @throws AccessDeniedHttpException + * + * @return Response + */ + protected function doEditAction(AbstractAdminListConfigurator $configurator, $entityId, Request $request) + { + /* @var EntityManager $em */ + $em = $this->getEntityManager(); + $helper = $em->getRepository($configurator->getRepositoryName())->findOneById($entityId); + + if ($helper === null) { + throw new NotFoundHttpException('Entity not found.'); + } + + if (!$configurator->canEdit($helper)) { + throw $this->createAccessDeniedException('You do not have sufficient rights to access this page.'); + } + + // This entity is locked + if (($helper instanceof LockableEntityInterface) && $this->isLockableEntityLocked($helper)) { + $indexUrl = $configurator->getIndexUrl(); + // Don't redirect to listing when coming from ajax request, needed for url chooser. + if (!$request->isXmlHttpRequest()) { + /** @var EntityVersionLockService $entityVersionLockService */ + $entityVersionLockService = $this->container->get('kunstmaan_entity.admin_entity.entity_version_lock_service'); + + $user = $entityVersionLockService->getUsersWithEntityVersionLock($helper, $this->getUser()); + $message = $this->container->get('translator')->trans('kuma_admin_list.edit.flash.locked', ['%user%' => implode(', ', $user)]); + $this->addFlash( + FlashTypes::WARNING, + $message + ); + + return new RedirectResponse( + $this->generateUrl( + $indexUrl['path'], + isset($indexUrl['params']) ? $indexUrl['params'] : [] + ) + ); + } + } + + $formType = $configurator->getAdminType($helper); + + $event = new AdaptSimpleFormEvent($request, $formType, $helper, $configurator->getAdminTypeOptions()); + $event = $this->dispatch($event, Events::ADAPT_SIMPLE_FORM); + $tabPane = $event->getTabPane(); + + $form = $this->createForm($formType, $helper, $event->getOptions()); + + if ($request->isMethod('POST')) { + if ($tabPane) { + $tabPane->bindRequest($request); + $form = $tabPane->getForm(); + } else { + $form->handleRequest($request); + } + + // Don't redirect to listing when coming from ajax request, needed for url chooser. + if ($form->isSubmitted() && $form->isValid() && !$request->isXmlHttpRequest()) { + $adminListEvent = new AdminListEvent($helper, $request, $form); + $this->dispatch( + $adminListEvent, + AdminListEvents::PRE_EDIT + ); + + // Check if Response is given + if ($adminListEvent->getResponse() instanceof Response) { + return $adminListEvent->getResponse(); + } + + $em->persist($helper); + $em->flush(); + $this->dispatch( + $adminListEvent, + AdminListEvents::POST_EDIT + ); + + // Check if Response is given + if ($adminListEvent->getResponse() instanceof Response) { + return $adminListEvent->getResponse(); + } + + $indexUrl = $configurator->getIndexUrl(); + + // Don't redirect to listing when coming from ajax request, needed for url chooser. + if (!$request->isXmlHttpRequest()) { + return new RedirectResponse( + $this->generateUrl( + $indexUrl['path'], + isset($indexUrl['params']) ? $indexUrl['params'] : [] + ) + ); + } + } + } + + $configurator->buildItemActions(); + + $params = [ + 'form' => $form->createView(), + 'entity' => $helper, 'adminlistconfigurator' => $configurator, + 'entityVersionLockInterval' => $this->container->getParameter('kunstmaan_entity.lock_check_interval'), + 'entityVersionLockCheck' => $this->container->getParameter('kunstmaan_entity.lock_enabled') && $helper instanceof LockableEntityInterface, + ]; + + if ($tabPane) { + $params = array_merge($params, ['tabPane' => $tabPane]); + } + + return new Response( + $this->renderView( + $configurator->getEditTemplate(), + $params + ) + ); + } + + protected function doViewAction(AbstractAdminListConfigurator $configurator, $entityId, Request $request) + { + /* @var EntityManager $em */ + $em = $this->getEntityManager(); + $helper = $em->getRepository($configurator->getRepositoryName())->findOneById($entityId); + if ($helper === null) { + throw new NotFoundHttpException('Entity not found.'); + } + + if (!$configurator->canView($helper)) { + throw $this->createAccessDeniedException('You do not have sufficient rights to access this page.'); + } + + $MetaData = $em->getClassMetadata($configurator->getRepositoryName()); + $fields = []; + $accessor = PropertyAccess::createPropertyAccessor(); + foreach ($MetaData->fieldNames as $value) { + $fields[$value] = $accessor->getValue($helper, $value); + } + + return new Response( + $this->renderView( + $configurator->getViewTemplate(), + ['entity' => $helper, 'adminlistconfigurator' => $configurator, 'fields' => $fields] + ) + ); + } + + /** + * Delete the Entity using its ID + * + * @param AbstractAdminListConfigurator $configurator The adminlist configurator + * @param int $entityId The id to delete + * @param Request|null $request + * + * @throws NotFoundHttpException + * @throws AccessDeniedHttpException + * + * @return Response + */ + protected function doDeleteAction(AbstractAdminListConfigurator $configurator, $entityId, Request $request) + { + /* @var $em EntityManager */ + $em = $this->getEntityManager(); + $helper = $em->getRepository($configurator->getRepositoryName())->findOneById($entityId); + if ($helper === null) { + throw new NotFoundHttpException('Entity not found.'); + } + if (!$configurator->canDelete($helper)) { + throw $this->createAccessDeniedException('You do not have sufficient rights to access this page.'); + } + + $indexUrl = $configurator->getIndexUrl(); + if ($request->isMethod('POST')) { + $adminListEvent = new AdminListEvent($helper, $request); + $this->dispatch( + $adminListEvent, + AdminListEvents::PRE_DELETE + ); + + // Check if Response is given + if ($adminListEvent->getResponse() instanceof Response) { + return $adminListEvent->getResponse(); + } + + $em->remove($helper); + $em->flush(); + $this->dispatch( + $adminListEvent, + AdminListEvents::POST_DELETE + ); + + // Check if Response is given + if ($adminListEvent->getResponse() instanceof Response) { + return $adminListEvent->getResponse(); + } + } + + return new RedirectResponse( + $this->generateUrl($indexUrl['path'], isset($indexUrl['params']) ? $indexUrl['params'] : []) + ); + } + + /** + * Move an item up in the list. + * + * @return RedirectResponse + */ + protected function doMoveUpAction(AbstractAdminListConfigurator $configurator, $entityId, Request $request) + { + $em = $this->getEntityManager(); + $sortableField = $configurator->getSortableField(); + + $repositoryName = $this->getAdminListRepositoryName($configurator); + + $repo = $em->getRepository($repositoryName); + $item = $repo->find($entityId); + + $setter = 'set' . ucfirst($sortableField); + $getter = 'get' . ucfirst($sortableField); + + $nextItem = $repo->createQueryBuilder('i') + ->where('i.' . $sortableField . ' < :weight') + ->setParameter('weight', $item->$getter()) + ->orderBy('i.' . $sortableField, 'DESC') + ->setMaxResults(1) + ->getQuery() + ->getOneOrNullResult(); + if ($nextItem) { + $nextItem->$setter($item->$getter()); + $em->persist($nextItem); + $item->$setter($item->$getter() - 1); + + $em->persist($item); + $em->flush(); + } + + $indexUrl = $configurator->getIndexUrl(); + + return new RedirectResponse( + $this->generateUrl($indexUrl['path'], isset($indexUrl['params']) ? $indexUrl['params'] : []) + ); + } + + protected function doMoveDownAction(AbstractAdminListConfigurator $configurator, $entityId, Request $request) + { + $em = $this->getEntityManager(); + $sortableField = $configurator->getSortableField(); + + $repositoryName = $this->getAdminListRepositoryName($configurator); + + $repo = $em->getRepository($repositoryName); + $item = $repo->find($entityId); + + $setter = 'set' . ucfirst($sortableField); + $getter = 'get' . ucfirst($sortableField); + + $nextItem = $repo->createQueryBuilder('i') + ->where('i.' . $sortableField . ' > :weight') + ->setParameter('weight', $item->$getter()) + ->orderBy('i.' . $sortableField, 'ASC') + ->setMaxResults(1) + ->getQuery() + ->getOneOrNullResult(); + if ($nextItem) { + $nextItem->$setter($item->$getter()); + $em->persist($nextItem); + $item->$setter($item->$getter() + 1); + + $em->persist($item); + $em->flush(); + } + + $indexUrl = $configurator->getIndexUrl(); + + return new RedirectResponse( + $this->generateUrl($indexUrl['path'], isset($indexUrl['params']) ? $indexUrl['params'] : []) + ); + } + + private function getMaxSortableField($repo, $sort) + { + $maxWeight = $repo->createQueryBuilder('i') + ->select('max(i.' . $sort . ')') + ->getQuery() + ->getSingleScalarResult(); + + return (int) $maxWeight; + } + + /** + * @return bool + */ + protected function isLockableEntityLocked(LockableEntityInterface $entity) + { + /** @var EntityVersionLockService $entityVersionLockService */ + $entityVersionLockService = $this->container->get('kunstmaan_entity.admin_entity.entity_version_lock_service'); + + return $entityVersionLockService->isEntityBelowThreshold($entity) && $entityVersionLockService->isEntityLocked( + $this->getUser(), + $entity + ); + } + + /** + * Sets the sort weight on a new item. Can be overridden if a non-default sorting implementation is being used. + * + * @param AbstractAdminListConfigurator $configurator The adminlist configurator + * + * @return mixed + */ + protected function setSortWeightOnNewItem(AbstractAdminListConfigurator $configurator, $item) + { + if ($configurator instanceof SortableInterface) { + $repo = $this->getEntityManager()->getRepository($configurator->getRepositoryName()); + $sort = $configurator->getSortableField(); + $weight = $this->getMaxSortableField($repo, $sort); + $setter = 'set' . ucfirst($sort); + $item->$setter($weight + 1); + } + + return $item; + } + + protected function buildSortableFieldActions(AbstractAdminListConfigurator $configurator) + { + // Check if Sortable interface is implemented + if ($configurator instanceof SortableInterface) { + $route = function (EntityInterface $item) use ($configurator) { + return [ + 'path' => $configurator->getPathByConvention() . '_move_up', + 'params' => ['id' => $item->getId()], + ]; + }; + + $action = new SimpleItemAction($route, 'arrow-up', 'kuma_admin_list.action.move_up'); + $configurator->addItemAction($action); + + $route = function (EntityInterface $item) use ($configurator) { + return [ + 'path' => $configurator->getPathByConvention() . '_move_down', + 'params' => ['id' => $item->getId()], + ]; + }; + + $action = new SimpleItemAction($route, 'arrow-down', 'kuma_admin_list.action.move_down'); + $configurator->addItemAction($action); + } + } + + /** + * @return string + */ + protected function getAdminListRepositoryName(AbstractAdminListConfigurator $configurator) + { + $em = $this->getEntityManager(); + $className = $em->getClassMetadata($configurator->getRepositoryName())->getName(); + + $implements = class_implements($className); + if (isset($implements[HasNodeInterface::class])) { + return NodeTranslation::class; + } + + return $configurator->getRepositoryName(); + } + + /** + * @param object $event + * + * @return object + */ + private function dispatch($event, string $eventName) + { + $eventDispatcher = $this->container->get('event_dispatcher'); + if (class_exists(LegacyEventDispatcherProxy::class)) { + $eventDispatcher = LegacyEventDispatcherProxy::decorate($eventDispatcher); + + return $eventDispatcher->dispatch($event, $eventName); + } + + return $eventDispatcher->dispatch($eventName, $event); + } + + public static function getSubscribedServices(): array + { + return array_merge(parent::getSubscribedServices(), [ + AdminListFactory::class, + ExportService::class, + EntityVersionLockService::class, + interface_exists(TranslatorInterface::class) ? TranslatorInterface::class : LegacyTranslatorInterface::class, + EventDispatcherInterface::class, + ]); + } +} diff --git a/src/Kunstmaan/AdminListBundle/Controller/AdminListController.php b/src/Kunstmaan/AdminListBundle/Controller/AdminListController.php index 543094b89a..50d4dd3e6c 100644 --- a/src/Kunstmaan/AdminListBundle/Controller/AdminListController.php +++ b/src/Kunstmaan/AdminListBundle/Controller/AdminListController.php @@ -26,6 +26,9 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\PropertyAccess\PropertyAccess; +/** + * @deprecated sinc KunstmaanAdminListBundle 5.9 and will be removed in KunstmaanAdminListBundle 6.0. Extend from "Kunstmaan\AdminListBundle\Controller\AbstractAdminListController" instead. + */ abstract class AdminListController extends Controller { /** diff --git a/src/Kunstmaan/AdminListBundle/Controller/EntityLockCheckController.php b/src/Kunstmaan/AdminListBundle/Controller/EntityLockCheckController.php index 0d89d45b7b..f3268485f1 100644 --- a/src/Kunstmaan/AdminListBundle/Controller/EntityLockCheckController.php +++ b/src/Kunstmaan/AdminListBundle/Controller/EntityLockCheckController.php @@ -10,6 +10,9 @@ use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Security\Core\Exception\AccessDeniedException; +/** + * @final since 5.9 + */ class EntityLockCheckController extends Controller { /** diff --git a/src/Kunstmaan/AdminListBundle/Resources/config/services.yml b/src/Kunstmaan/AdminListBundle/Resources/config/services.yml index 13f5948957..65cdd93ddc 100644 --- a/src/Kunstmaan/AdminListBundle/Resources/config/services.yml +++ b/src/Kunstmaan/AdminListBundle/Resources/config/services.yml @@ -2,6 +2,11 @@ parameters: kunstmaan_adminlist.service.export.class: Kunstmaan\AdminListBundle\Service\ExportService services: + # Autowire aliases + Kunstmaan\AdminListBundle\AdminList\AdminListFactory: '@kunstmaan_adminlist.factory' + Kunstmaan\AdminListBundle\Service\ExportService: '@kunstmaan_adminlist.service.export' + Kunstmaan\AdminListBundle\Service\EntityVersionLockService: '@kunstmaan_entity.admin_entity.entity_version_lock_service' + kunstmaan_adminlist.factory: class: Kunstmaan\AdminListBundle\AdminList\AdminListFactory public: true diff --git a/src/Kunstmaan/CacheBundle/Controller/VarnishController.php b/src/Kunstmaan/CacheBundle/Controller/VarnishController.php index 5930703463..648bfce96b 100644 --- a/src/Kunstmaan/CacheBundle/Controller/VarnishController.php +++ b/src/Kunstmaan/CacheBundle/Controller/VarnishController.php @@ -12,6 +12,9 @@ use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Security\Core\Exception\AccessDeniedException; +/** + * @final since 5.9 + */ class VarnishController extends Controller { /** diff --git a/src/Kunstmaan/ConfigBundle/Controller/ConfigController.php b/src/Kunstmaan/ConfigBundle/Controller/ConfigController.php index 47bb08f344..ad1b9e7747 100644 --- a/src/Kunstmaan/ConfigBundle/Controller/ConfigController.php +++ b/src/Kunstmaan/ConfigBundle/Controller/ConfigController.php @@ -16,6 +16,9 @@ use Symfony\Component\Security\Core\Exception\AccessDeniedException; use Twig\Environment; +/** + * @final since 5.9 + */ class ConfigController { /** diff --git a/src/Kunstmaan/DashboardBundle/Controller/DashboardController.php b/src/Kunstmaan/DashboardBundle/Controller/DashboardController.php index b694116eb9..a10830e36b 100644 --- a/src/Kunstmaan/DashboardBundle/Controller/DashboardController.php +++ b/src/Kunstmaan/DashboardBundle/Controller/DashboardController.php @@ -9,6 +9,9 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; +/** + * @final since 5.9 + */ class DashboardController extends Controller { /** diff --git a/src/Kunstmaan/DashboardBundle/Controller/GoogleAnalyticsAJAXController.php b/src/Kunstmaan/DashboardBundle/Controller/GoogleAnalyticsAJAXController.php index 12b88da8db..a2ece506b8 100644 --- a/src/Kunstmaan/DashboardBundle/Controller/GoogleAnalyticsAJAXController.php +++ b/src/Kunstmaan/DashboardBundle/Controller/GoogleAnalyticsAJAXController.php @@ -16,6 +16,9 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\Annotation\Route; +/** + * @final since 5.9 + */ class GoogleAnalyticsAJAXController extends Controller { /** diff --git a/src/Kunstmaan/DashboardBundle/Controller/GoogleAnalyticsController.php b/src/Kunstmaan/DashboardBundle/Controller/GoogleAnalyticsController.php index 61fe3ac392..afef1a6463 100644 --- a/src/Kunstmaan/DashboardBundle/Controller/GoogleAnalyticsController.php +++ b/src/Kunstmaan/DashboardBundle/Controller/GoogleAnalyticsController.php @@ -15,6 +15,9 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Security\Core\Exception\AccessDeniedException; +/** + * @final since 5.9 + */ class GoogleAnalyticsController extends Controller { /** diff --git a/src/Kunstmaan/FormBundle/Controller/FormSubmissionsController.php b/src/Kunstmaan/FormBundle/Controller/FormSubmissionsController.php index c5b17dd8d3..3a6284cb09 100644 --- a/src/Kunstmaan/FormBundle/Controller/FormSubmissionsController.php +++ b/src/Kunstmaan/FormBundle/Controller/FormSubmissionsController.php @@ -23,6 +23,8 @@ /** * The controller which will handle everything related with form pages and form submissions + * + * @final since 5.9 */ class FormSubmissionsController extends Controller { diff --git a/src/Kunstmaan/GeneratorBundle/Resources/SensioGeneratorBundle/skeleton/adminlist/Controller/EntityAdminListController.php b/src/Kunstmaan/GeneratorBundle/Resources/SensioGeneratorBundle/skeleton/adminlist/Controller/EntityAdminListController.php index 59f497d8f9..fb35608ecd 100755 --- a/src/Kunstmaan/GeneratorBundle/Resources/SensioGeneratorBundle/skeleton/adminlist/Controller/EntityAdminListController.php +++ b/src/Kunstmaan/GeneratorBundle/Resources/SensioGeneratorBundle/skeleton/adminlist/Controller/EntityAdminListController.php @@ -4,7 +4,7 @@ use {{ namespace }}\AdminList\{{ entity_class }}AdminListConfigurator; use Kunstmaan\AdminListBundle\AdminList\Configurator\AdminListConfiguratorInterface; -use Kunstmaan\AdminListBundle\Controller\AdminListController; +use Kunstmaan\AdminListBundle\Controller\AbstractAdminListController; use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -15,7 +15,7 @@ * @Route("/{_locale}/%kunstmaan_admin.admin_prefix%/{{ entity_class|lower }}", requirements={"_locale"="%requiredlocales%"}) */ {% endif %} -class {{ entity_class }}AdminListController extends AdminListController +class {{ entity_class }}AdminListController extends AbstractAdminListController { /** * @var AdminListConfiguratorInterface diff --git a/src/Kunstmaan/GeneratorBundle/Resources/SensioGeneratorBundle/skeleton/defaultsite/Controller/BikeAdminListController.php b/src/Kunstmaan/GeneratorBundle/Resources/SensioGeneratorBundle/skeleton/defaultsite/Controller/BikeAdminListController.php index 61c321a159..3b3d2107c2 100644 --- a/src/Kunstmaan/GeneratorBundle/Resources/SensioGeneratorBundle/skeleton/defaultsite/Controller/BikeAdminListController.php +++ b/src/Kunstmaan/GeneratorBundle/Resources/SensioGeneratorBundle/skeleton/defaultsite/Controller/BikeAdminListController.php @@ -3,7 +3,7 @@ namespace {{ namespace }}\Controller; use Kunstmaan\AdminListBundle\AdminList\Configurator\AdminListConfiguratorInterface; -use Kunstmaan\AdminListBundle\Controller\AdminListController; +use Kunstmaan\AdminListBundle\Controller\AbstractAdminListController; use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\HttpFoundation\Request; use {{ namespace }}\AdminList\BikeAdminListConfigurator; @@ -14,7 +14,7 @@ * @Route("/{_locale}/%kunstmaan_admin.admin_prefix%/bike", requirements={"_locale"="%requiredlocales%"}) */ {% endif %} -class BikeAdminListController extends AdminListController +class BikeAdminListController extends AbstractAdminListController { /** * @var AdminListConfiguratorInterface diff --git a/src/Kunstmaan/LeadGenerationBundle/Controller/PopupsAdminListController.php b/src/Kunstmaan/LeadGenerationBundle/Controller/PopupsAdminListController.php index 357f40cb92..81b23e9778 100644 --- a/src/Kunstmaan/LeadGenerationBundle/Controller/PopupsAdminListController.php +++ b/src/Kunstmaan/LeadGenerationBundle/Controller/PopupsAdminListController.php @@ -10,6 +10,9 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\Annotation\Route; +/** + * @final since 5.9 + */ class PopupsAdminListController extends AdminListController { /** diff --git a/src/Kunstmaan/LeadGenerationBundle/Controller/RulesAdminListController.php b/src/Kunstmaan/LeadGenerationBundle/Controller/RulesAdminListController.php index 17e2199f7a..d6308ba39d 100644 --- a/src/Kunstmaan/LeadGenerationBundle/Controller/RulesAdminListController.php +++ b/src/Kunstmaan/LeadGenerationBundle/Controller/RulesAdminListController.php @@ -8,6 +8,9 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\Annotation\Route; +/** + * @final since 5.9 + */ class RulesAdminListController extends AdminListController { /** diff --git a/src/Kunstmaan/MediaBundle/Controller/ChooserController.php b/src/Kunstmaan/MediaBundle/Controller/ChooserController.php index 819128f0a0..aa090413f7 100644 --- a/src/Kunstmaan/MediaBundle/Controller/ChooserController.php +++ b/src/Kunstmaan/MediaBundle/Controller/ChooserController.php @@ -16,7 +16,7 @@ use Symfony\Component\Routing\Annotation\Route; /** - * ChooserController. + * @final since 5.9 */ class ChooserController extends Controller { diff --git a/src/Kunstmaan/MediaBundle/Controller/FolderController.php b/src/Kunstmaan/MediaBundle/Controller/FolderController.php index 9065e17795..ac88ee22a4 100644 --- a/src/Kunstmaan/MediaBundle/Controller/FolderController.php +++ b/src/Kunstmaan/MediaBundle/Controller/FolderController.php @@ -18,7 +18,7 @@ use Symfony\Component\Routing\Annotation\Route; /** - * FolderController. + * @final since 5.9 */ class FolderController extends Controller { diff --git a/src/Kunstmaan/MediaBundle/Controller/IconFontController.php b/src/Kunstmaan/MediaBundle/Controller/IconFontController.php index 9d09e731f4..4d244687aa 100644 --- a/src/Kunstmaan/MediaBundle/Controller/IconFontController.php +++ b/src/Kunstmaan/MediaBundle/Controller/IconFontController.php @@ -8,7 +8,7 @@ use Symfony\Component\Routing\Annotation\Route; /** - * IconFontController + * @final since 5.9 */ class IconFontController extends Controller { diff --git a/src/Kunstmaan/MediaBundle/Controller/MediaController.php b/src/Kunstmaan/MediaBundle/Controller/MediaController.php index fd1cc3ccb8..8daab8e41f 100644 --- a/src/Kunstmaan/MediaBundle/Controller/MediaController.php +++ b/src/Kunstmaan/MediaBundle/Controller/MediaController.php @@ -18,7 +18,7 @@ use Symfony\Component\Routing\Annotation\Route; /** - * MediaController + * @final since 5.9 */ class MediaController extends Controller { diff --git a/src/Kunstmaan/MenuBundle/Controller/MenuAdminListController.php b/src/Kunstmaan/MenuBundle/Controller/MenuAdminListController.php index c565771763..09e94874fc 100644 --- a/src/Kunstmaan/MenuBundle/Controller/MenuAdminListController.php +++ b/src/Kunstmaan/MenuBundle/Controller/MenuAdminListController.php @@ -10,6 +10,9 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\Annotation\Route; +/** + * @final since 5.9 + */ class MenuAdminListController extends AdminListController { /** diff --git a/src/Kunstmaan/MenuBundle/Controller/MenuItemAdminListController.php b/src/Kunstmaan/MenuBundle/Controller/MenuItemAdminListController.php index a639570eff..f6a0a8978b 100644 --- a/src/Kunstmaan/MenuBundle/Controller/MenuItemAdminListController.php +++ b/src/Kunstmaan/MenuBundle/Controller/MenuItemAdminListController.php @@ -13,6 +13,9 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; +/** + * @final since 5.9 + */ class MenuItemAdminListController extends AdminListController { /** diff --git a/src/Kunstmaan/MultiDomainBundle/Controller/SiteSwitchController.php b/src/Kunstmaan/MultiDomainBundle/Controller/SiteSwitchController.php index 152e08bdc1..92240d9671 100644 --- a/src/Kunstmaan/MultiDomainBundle/Controller/SiteSwitchController.php +++ b/src/Kunstmaan/MultiDomainBundle/Controller/SiteSwitchController.php @@ -11,6 +11,9 @@ use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Security\Core\Exception\AccessDeniedException; +/** + * @final since 5.9 + */ class SiteSwitchController extends Controller { /** diff --git a/src/Kunstmaan/NodeBundle/Controller/NodeAdminController.php b/src/Kunstmaan/NodeBundle/Controller/NodeAdminController.php index 31157b2a5c..10647db903 100644 --- a/src/Kunstmaan/NodeBundle/Controller/NodeAdminController.php +++ b/src/Kunstmaan/NodeBundle/Controller/NodeAdminController.php @@ -47,7 +47,7 @@ use Symfony\Component\Translation\TranslatorInterface; /** - * NodeAdminController + * @final since 5.9 */ class NodeAdminController extends Controller { diff --git a/src/Kunstmaan/NodeBundle/Controller/SlugController.php b/src/Kunstmaan/NodeBundle/Controller/SlugController.php index 105cbf3036..289c2db130 100644 --- a/src/Kunstmaan/NodeBundle/Controller/SlugController.php +++ b/src/Kunstmaan/NodeBundle/Controller/SlugController.php @@ -22,7 +22,7 @@ use Symfony\Component\Security\Core\Exception\AccessDeniedException; /** - * This controller is for showing frontend pages based on slugs + * @final since 5.9 */ class SlugController extends Controller { diff --git a/src/Kunstmaan/NodeBundle/Controller/UrlReplaceController.php b/src/Kunstmaan/NodeBundle/Controller/UrlReplaceController.php index 4db98d1922..28a9760513 100644 --- a/src/Kunstmaan/NodeBundle/Controller/UrlReplaceController.php +++ b/src/Kunstmaan/NodeBundle/Controller/UrlReplaceController.php @@ -7,6 +7,9 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\Annotation\Route; +/** + * @final since 5.9 + */ class UrlReplaceController { /** diff --git a/src/Kunstmaan/NodeBundle/Controller/WidgetsController.php b/src/Kunstmaan/NodeBundle/Controller/WidgetsController.php index f572359a84..42c80316e0 100644 --- a/src/Kunstmaan/NodeBundle/Controller/WidgetsController.php +++ b/src/Kunstmaan/NodeBundle/Controller/WidgetsController.php @@ -15,7 +15,7 @@ use Symfony\Component\Routing\Annotation\Route; /** - * WidgetsController + * @final since 5.9 */ class WidgetsController extends Controller { diff --git a/src/Kunstmaan/PagePartBundle/Controller/PagePartAdminController.php b/src/Kunstmaan/PagePartBundle/Controller/PagePartAdminController.php index 8cf30e3d7c..b2affb959d 100644 --- a/src/Kunstmaan/PagePartBundle/Controller/PagePartAdminController.php +++ b/src/Kunstmaan/PagePartBundle/Controller/PagePartAdminController.php @@ -12,7 +12,7 @@ use Symfony\Component\Routing\Annotation\Route; /** - * Controller for the pagepart administration + * @final since 5.9 */ class PagePartAdminController extends Controller { diff --git a/src/Kunstmaan/RedirectBundle/Controller/RedirectAdminListController.php b/src/Kunstmaan/RedirectBundle/Controller/RedirectAdminListController.php index 949034217e..a1c5b90b00 100644 --- a/src/Kunstmaan/RedirectBundle/Controller/RedirectAdminListController.php +++ b/src/Kunstmaan/RedirectBundle/Controller/RedirectAdminListController.php @@ -9,6 +9,9 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; +/** + * @final since 5.9 + */ class RedirectAdminListController extends AdminListController { /** diff --git a/src/Kunstmaan/SeoBundle/Controller/Admin/SettingsController.php b/src/Kunstmaan/SeoBundle/Controller/Admin/SettingsController.php index 344a869f5c..878e89505e 100644 --- a/src/Kunstmaan/SeoBundle/Controller/Admin/SettingsController.php +++ b/src/Kunstmaan/SeoBundle/Controller/Admin/SettingsController.php @@ -11,6 +11,9 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\Annotation\Route; +/** + * @final since 5.9 + */ class SettingsController extends BaseSettingsController { /** diff --git a/src/Kunstmaan/SeoBundle/Controller/RobotsController.php b/src/Kunstmaan/SeoBundle/Controller/RobotsController.php index e1e86f6449..a89c3b9d27 100644 --- a/src/Kunstmaan/SeoBundle/Controller/RobotsController.php +++ b/src/Kunstmaan/SeoBundle/Controller/RobotsController.php @@ -8,6 +8,9 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\Annotation\Route; +/** + * @final since 5.9 + */ class RobotsController extends Controller { /** diff --git a/src/Kunstmaan/SitemapBundle/Controller/SitemapController.php b/src/Kunstmaan/SitemapBundle/Controller/SitemapController.php index 35bf04791c..0ec57aa6c6 100644 --- a/src/Kunstmaan/SitemapBundle/Controller/SitemapController.php +++ b/src/Kunstmaan/SitemapBundle/Controller/SitemapController.php @@ -9,6 +9,9 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\Annotation\Route; +/** + * @final since 5.9 + */ class SitemapController extends Controller { /** diff --git a/src/Kunstmaan/TaggingBundle/Controller/TagAdminListController.php b/src/Kunstmaan/TaggingBundle/Controller/TagAdminListController.php index 72a2758816..b3b539d3d9 100644 --- a/src/Kunstmaan/TaggingBundle/Controller/TagAdminListController.php +++ b/src/Kunstmaan/TaggingBundle/Controller/TagAdminListController.php @@ -10,6 +10,9 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\Annotation\Route; +/** + * @final since 5.9 + */ class TagAdminListController extends AdminListController { /** diff --git a/src/Kunstmaan/TranslatorBundle/Controller/TranslatorCommandController.php b/src/Kunstmaan/TranslatorBundle/Controller/TranslatorCommandController.php index 44794d7569..0b3256f037 100644 --- a/src/Kunstmaan/TranslatorBundle/Controller/TranslatorCommandController.php +++ b/src/Kunstmaan/TranslatorBundle/Controller/TranslatorCommandController.php @@ -9,6 +9,9 @@ use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\Routing\Annotation\Route; +/** + * @final since 5.9 + */ class TranslatorCommandController extends Controller { /** diff --git a/src/Kunstmaan/TranslatorBundle/Controller/TranslatorController.php b/src/Kunstmaan/TranslatorBundle/Controller/TranslatorController.php index 8df20c61a1..56e6ea8909 100644 --- a/src/Kunstmaan/TranslatorBundle/Controller/TranslatorController.php +++ b/src/Kunstmaan/TranslatorBundle/Controller/TranslatorController.php @@ -22,6 +22,9 @@ use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Translation\TranslatorInterface; +/** + * @final since 5.9 + */ class TranslatorController extends AdminListController { /** diff --git a/src/Kunstmaan/UserManagementBundle/Controller/GroupsController.php b/src/Kunstmaan/UserManagementBundle/Controller/GroupsController.php index 7815848b74..a99fbf615c 100644 --- a/src/Kunstmaan/UserManagementBundle/Controller/GroupsController.php +++ b/src/Kunstmaan/UserManagementBundle/Controller/GroupsController.php @@ -17,6 +17,8 @@ /** * Settings controller handling everything related to creating, editing, deleting and listing groups in an admin list + * + * @final since 5.9 */ class GroupsController extends BaseSettingsController { diff --git a/src/Kunstmaan/UserManagementBundle/Controller/RolesController.php b/src/Kunstmaan/UserManagementBundle/Controller/RolesController.php index 0724f6e2ce..5acdc363ad 100644 --- a/src/Kunstmaan/UserManagementBundle/Controller/RolesController.php +++ b/src/Kunstmaan/UserManagementBundle/Controller/RolesController.php @@ -17,6 +17,8 @@ /** * Settings controller handling everything related to creating, editing, deleting and listing roles in an admin list + * + * @final since 5.9 */ class RolesController extends BaseSettingsController { diff --git a/src/Kunstmaan/UserManagementBundle/Controller/UsersController.php b/src/Kunstmaan/UserManagementBundle/Controller/UsersController.php index 75e7ed06e7..3faf35803f 100644 --- a/src/Kunstmaan/UserManagementBundle/Controller/UsersController.php +++ b/src/Kunstmaan/UserManagementBundle/Controller/UsersController.php @@ -25,6 +25,8 @@ /** * Settings controller handling everything related to creating, editing, deleting and listing users in an admin list + * + * @final since 5.9 */ class UsersController extends BaseSettingsController { diff --git a/src/Kunstmaan/VotingBundle/Controller/VotingController.php b/src/Kunstmaan/VotingBundle/Controller/VotingController.php index e8044185f4..7ebf8a7ca1 100644 --- a/src/Kunstmaan/VotingBundle/Controller/VotingController.php +++ b/src/Kunstmaan/VotingBundle/Controller/VotingController.php @@ -14,6 +14,9 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\Annotation\Route; +/** + * @final since 5.9 + */ class VotingController extends Controller { /**