From 91edb14fb2a2e6fcc0e33286272773981e4ccdd9 Mon Sep 17 00:00:00 2001 From: Tchama Date: Thu, 30 Jul 2020 17:34:45 +0200 Subject: [PATCH] sf4, repair errors and make basic and admin chill pages works --- Controller/AdminController.php | 4 +- Controller/CenterController.php | 12 +-- Controller/DefaultController.php | 2 +- Controller/ExportController.php | 10 +-- Controller/PasswordController.php | 2 +- Controller/PermissionsGroupController.php | 95 +++++++++++++++------- Controller/ScopeController.php | 12 +-- Controller/SearchController.php | 16 ++-- Controller/UIController.php | 2 +- Controller/UserController.php | 18 ++-- DependencyInjection/ChillMainExtension.php | 2 +- Pagination/ChillPaginationTwig.php | 6 +- Resources/config/services/controller.yml | 10 ++- Routing/MenuTwig.php | 2 +- Security/RoleProvider.php | 4 +- Timeline/TimelineBuilder.php | 2 +- templates/Menu/verticalMenu.html.twig | 4 +- 17 files changed, 126 insertions(+), 77 deletions(-) diff --git a/Controller/AdminController.php b/Controller/AdminController.php index 9852be7ab..9a528b0b8 100644 --- a/Controller/AdminController.php +++ b/Controller/AdminController.php @@ -34,12 +34,12 @@ class AdminController extends Controller { public function indexAction($menu = 'admin', $header_title = 'views.Main.admin.index.header_title', $page_title = 'views.Main.admin.index.page_title') { - return $this->render('ChillMainBundle:Admin:layout.html.twig'); + return $this->render('@ChillMain/Admin/layout.html.twig'); } public function indexPermissionsAction() { - return $this->render('ChillMainBundle:Admin:layout_permissions.html.twig'); + return $this->render('@ChillMain/Admin/layout_permissions.html.twig'); } public function configurationWarningsAction() diff --git a/Controller/CenterController.php b/Controller/CenterController.php index 9fabb50aa..be0372040 100644 --- a/Controller/CenterController.php +++ b/Controller/CenterController.php @@ -27,7 +27,7 @@ class CenterController extends Controller $entities = $em->getRepository('ChillMainBundle:Center')->findAll(); - return $this->render('ChillMainBundle:Center:index.html.twig', array( + return $this->render('@ChillMain/Center/index.html.twig', array( 'entities' => $entities, )); } @@ -49,7 +49,7 @@ class CenterController extends Controller return $this->redirect($this->generateUrl('admin_center_show', array('id' => $center->getId()))); } - return $this->render('ChillMainBundle:Center:new.html.twig', array( + return $this->render('@ChillMain/Center/new.html.twig', array( 'entity' => $center, 'form' => $form->createView(), )); @@ -83,7 +83,7 @@ class CenterController extends Controller $center = new Center(); $form = $this->createCreateForm($center); - return $this->render('ChillMainBundle:Center:new.html.twig', array( + return $this->render('@ChillMain/Center/new.html.twig', array( 'entity' => $center, 'form' => $form->createView(), )); @@ -103,7 +103,7 @@ class CenterController extends Controller throw $this->createNotFoundException('Unable to find Center entity.'); } - return $this->render('ChillMainBundle:Center:show.html.twig', array( + return $this->render('@ChillMain/Center/show.html.twig', array( 'entity' => $center )); } @@ -123,7 +123,7 @@ class CenterController extends Controller } $editForm = $this->createEditForm($center); - return $this->render('ChillMainBundle:Center:edit.html.twig', array( + return $this->render('@ChillMain/Center/edit.html.twig', array( 'entity' => $center, 'edit_form' => $editForm->createView() )); @@ -170,7 +170,7 @@ class CenterController extends Controller return $this->redirect($this->generateUrl('admin_center_edit', array('id' => $id))); } - return $this->render('ChillMainBundle:Center:edit.html.twig', array( + return $this->render('@ChillMain/Center/edit.html.twig', array( 'entity' => $center, 'edit_form' => $editForm->createView() )); diff --git a/Controller/DefaultController.php b/Controller/DefaultController.php index 9a12824da..cd2de4472 100644 --- a/Controller/DefaultController.php +++ b/Controller/DefaultController.php @@ -23,7 +23,7 @@ class DefaultController extends Controller public function testAction() { - return $this->render('ChillMainBundle:Tabs:index.html.twig', [ + return $this->render('@ChillMain/Tabs/index.html.twig', [ 'tabs' => [ 'test1' => [ [ diff --git a/Controller/ExportController.php b/Controller/ExportController.php index ec8d9ee7a..0e0ebb4fc 100644 --- a/Controller/ExportController.php +++ b/Controller/ExportController.php @@ -109,7 +109,7 @@ class ExportController extends Controller $exports = $exportManager->getExportsGrouped(true); - return $this->render('ChillMainBundle:Export:layout.html.twig', array( + return $this->render('@ChillMain/Export/layout.html.twig', array( 'grouped_exports' => $exports )); } @@ -201,7 +201,7 @@ class ExportController extends Controller } } - return $this->render('ChillMainBundle:Export:new_centers_step.html.twig', + return $this->render('@ChillMain/Export/new_centers_step.html.twig', array( 'form' => $form->createView(), 'export' => $export @@ -262,7 +262,7 @@ class ExportController extends Controller } } - return $this->render('ChillMainBundle:Export:new.html.twig', array( + return $this->render('@ChillMain/Export/new.html.twig', array( 'form' => $form->createView(), 'export_alias' => $alias, 'export' => $export @@ -403,7 +403,7 @@ class ExportController extends Controller } } - return $this->render('ChillMainBundle:Export:new_formatter_step.html.twig', + return $this->render('@ChillMain/Export/new_formatter_step.html.twig', array( 'form' => $form->createView(), 'export' => $export @@ -543,6 +543,6 @@ class ExportController extends Controller $viewVariables['mime_type'] = 'text/csv'; } - return $this->render("ChillMainBundle:Export:download.html.twig", $viewVariables); + return $this->render("@ChillMain/Export/download.html.twig", $viewVariables); } } diff --git a/Controller/PasswordController.php b/Controller/PasswordController.php index dea72180d..3c2735e11 100644 --- a/Controller/PasswordController.php +++ b/Controller/PasswordController.php @@ -116,7 +116,7 @@ class PasswordController extends Controller } // render into a template - return $this->render('ChillMainBundle:Password:password.html.twig', array( + return $this->render('@ChillMain/Password/password.html.twig', array( 'form' => $form->createView() )); diff --git a/Controller/PermissionsGroupController.php b/Controller/PermissionsGroupController.php index 4c828c6aa..64f2edb27 100644 --- a/Controller/PermissionsGroupController.php +++ b/Controller/PermissionsGroupController.php @@ -2,6 +2,8 @@ namespace Chill\MainBundle\Controller; +use Chill\MainBundle\Security\RoleProvider; +use Chill\MainBundle\Templating\TranslatableStringHelper; use Symfony\Component\HttpFoundation\Request; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\Form\Extension\Core\Type\SubmitType; @@ -9,9 +11,10 @@ use Chill\MainBundle\Entity\RoleScope; use Chill\MainBundle\Entity\PermissionsGroup; use Chill\MainBundle\Form\PermissionsGroupType; use Symfony\Component\Security\Core\Role\Role; -use Symfony\Component\Security\Core\Role\RoleInterface; +use Symfony\Component\Security\Core\Role\RoleHierarchy; use Chill\MainBundle\Entity\Scope; use Chill\MainBundle\Form\Type\ComposedRoleScopeType; +use Symfony\Contracts\Translation\TranslatorInterface; /** * PermissionsGroup controller. @@ -19,7 +22,47 @@ use Chill\MainBundle\Form\Type\ComposedRoleScopeType; */ class PermissionsGroupController extends Controller { - + /** + * @var TranslatableStringHelper + */ + private $translatableStringHelper; + + /** + * @var RoleProvider $roleProvider + */ + private $roleProvider; + + /** + * @var RoleHierarchy $roleHierarchy + */ + private $roleHierarchy; + + /** + * @var TranslatorInterface + */ + private $translator; + + /** + * PermissionsGroupController constructor. + * + * @param TranslatableStringHelper $translatableStringHelper + * @param RoleProvider $roleProvider + * @param RoleHierarchy $roleHierarchy + * @param TranslatorInterface $translator + */ + public function __construct( + TranslatableStringHelper $translatableStringHelper, + RoleProvider $roleProvider, + RoleHierarchy $roleHierarchy, + TranslatorInterface $translator + ) + { + $this->translatableStringHelper = $translatableStringHelper; + $this->roleProvider = $roleProvider; + $this->roleHierarchy = $roleHierarchy; + $this->translator = $translator; + } + /** * Lists all PermissionsGroup entities. * @@ -30,7 +73,7 @@ class PermissionsGroupController extends Controller $entities = $em->getRepository('ChillMainBundle:PermissionsGroup')->findAll(); - return $this->render('ChillMainBundle:PermissionsGroup:index.html.twig', array( + return $this->render('@ChillMain/PermissionsGroup/index.html.twig', array( 'entities' => $entities, )); } @@ -54,7 +97,7 @@ class PermissionsGroupController extends Controller array('id' => $permissionsGroup->getId()))); } - return $this->render('ChillMainBundle:PermissionsGroup:new.html.twig', array( + return $this->render('@ChillMain/PermissionsGroup/new.html.twig', array( 'entity' => $permissionsGroup, 'form' => $form->createView(), )); @@ -88,7 +131,7 @@ class PermissionsGroupController extends Controller $permissionsGroup = new PermissionsGroup(); $form = $this->createCreateForm($permissionsGroup); - return $this->render('ChillMainBundle:PermissionsGroup:new.html.twig', array( + return $this->render('@ChillMain/PermissionsGroup/new.html.twig', array( 'entity' => $permissionsGroup, 'form' => $form->createView(), )); @@ -108,7 +151,7 @@ class PermissionsGroupController extends Controller throw $this->createNotFoundException('Unable to find PermissionsGroup entity.'); } - $translatableStringHelper = $this->get('chill.main.helper.translatable_string'); + $translatableStringHelper = $this->translatableStringHelper; $roleScopes = $permissionsGroup->getRoleScopes()->toArray(); // sort $roleScopes by name @@ -128,8 +171,7 @@ class PermissionsGroupController extends Controller }); // sort role scope by title - /* @var $roleProvider \Chill\MainBundle\Security\RoleProvider */ - $roleProvider = $this->get('chill.main.role_provider'); + $roleProvider = $this->roleProvider; $roleScopesSorted = array(); foreach($roleScopes as $roleScope) { /* @var $roleScope RoleScope */ @@ -138,7 +180,7 @@ class PermissionsGroupController extends Controller } ksort($roleScopesSorted); - return $this->render('ChillMainBundle:PermissionsGroup:show.html.twig', array( + return $this->render('@ChillMain/PermissionsGroup/show.html.twig', array( 'entity' => $permissionsGroup, 'role_scopes_sorted' => $roleScopesSorted, 'expanded_roles' => $this->getExpandedRoles($roleScopes) @@ -158,11 +200,10 @@ class PermissionsGroupController extends Controller if (!array_key_exists($roleScope->getRole(), $expandedRoles)) { $expandedRoles[$roleScope->getRole()] = array_map( - function(RoleInterface $role) { - + function(Role $role) { return $role->getRole(); }, - $this->get('security.role_hierarchy') + $this->roleHierarchy ->getReachableRoles( array(new Role($roleScope->getRole())) ) @@ -198,8 +239,7 @@ class PermissionsGroupController extends Controller $addRoleScopesForm = $this->createAddRoleScopeForm($permissionsGroup); // sort role scope by title - /* @var $roleProvider \Chill\MainBundle\Security\RoleProvider */ - $roleProvider = $this->get('chill.main.role_provider'); + $roleProvider = $this->roleProvider; $roleScopesSorted = array(); foreach($permissionsGroup->getRoleScopes()->toArray() as $roleScope) { /* @var $roleScope RoleScope */ @@ -208,7 +248,7 @@ class PermissionsGroupController extends Controller } ksort($roleScopesSorted); - return $this->render('ChillMainBundle:PermissionsGroup:edit.html.twig', array( + return $this->render('@ChillMain/PermissionsGroup/edit.html.twig', array( 'entity' => $permissionsGroup, 'role_scopes_sorted' => $roleScopesSorted, 'edit_form' => $editForm->createView(), @@ -276,8 +316,7 @@ class PermissionsGroupController extends Controller $addRoleScopesForm = $this->createAddRoleScopeForm($permissionsGroup); // sort role scope by title - /* @var $roleProvider \Chill\MainBundle\Security\RoleProvider */ - $roleProvider = $this->get('chill.main.role_provider'); + $roleProvider = $this->roleProvider; $roleScopesSorted = array(); foreach($permissionsGroup->getRoleScopes()->toArray() as $roleScope) { /* @var $roleScope RoleScope */ @@ -286,7 +325,7 @@ class PermissionsGroupController extends Controller } ksort($roleScopesSorted); - return $this->render('ChillMainBundle:PermissionsGroup:edit.html.twig', array( + return $this->render('@ChillMain/PermissionsGroup/edit.html.twig', array( 'entity' => $permissionsGroup, 'role_scopes_sorted' => $roleScopesSorted, 'edit_form' => $editForm->createView(), @@ -352,10 +391,10 @@ class PermissionsGroupController extends Controller $permissionsGroup->removeRoleScope($roleScope); } catch (\RuntimeException $ex) { $this->addFlash('notice', - $this->get('translator')->trans("The role '%role%' and circle " + $this->translator->trans("The role '%role%' and circle " . "'%scope%' is not associated with this permission group", array( - '%role%' => $this->get('translator')->trans($roleScope->getRole()), - '%scope%' => $this->get('chill.main.helper.translatable_string') + '%role%' => $this->translator->trans($roleScope->getRole()), + '%scope%' => $this->translatableStringHelper ->localize($roleScope->getScope()->getName()) ))); @@ -367,16 +406,16 @@ class PermissionsGroupController extends Controller if ($roleScope->getScope() !== NULL ) { $this->addFlash('notice', - $this->get('translator')->trans("The role '%role%' on circle " + $this->translator->trans("The role '%role%' on circle " . "'%scope%' has been removed", array( - '%role%' => $this->get('translator')->trans($roleScope->getRole()), - '%scope%' => $this->get('chill.main.helper.translatable_string') + '%role%' => $this->translator->trans($roleScope->getRole()), + '%scope%' => $this->translatableStringHelper ->localize($roleScope->getScope()->getName()) ))); } else { $this->addFlash('notice', - $this->get('translator')->trans("The role '%role%' has been removed", array( - '%role%' => $this->get('translator')->trans($roleScope->getRole()) + $this->translator->trans("The role '%role%' has been removed", array( + '%role%' => $this->translator->trans($roleScope->getRole()) ))); } @@ -417,7 +456,7 @@ class PermissionsGroupController extends Controller $em->flush(); $this->addFlash('notice', - $this->get('translator')->trans("The permissions have been added")); + $this->translator->trans("The permissions have been added")); return $this->redirect($this->generateUrl('admin_permissionsgroup_edit', array('id' => $id))); @@ -454,7 +493,7 @@ class PermissionsGroupController extends Controller } ksort($roleScopesSorted); - return $this->render('ChillMainBundle:PermissionsGroup:edit.html.twig', array( + return $this->render('@ChillMain/PermissionsGroup/edit.html.twig', array( 'entity' => $permissionsGroup, 'edit_form' => $editForm->createView(), 'role_scopes_sorted' => $roleScopesSorted, diff --git a/Controller/ScopeController.php b/Controller/ScopeController.php index a999a0b3b..a95ea0a1b 100644 --- a/Controller/ScopeController.php +++ b/Controller/ScopeController.php @@ -27,7 +27,7 @@ class ScopeController extends Controller $entities = $em->getRepository('ChillMainBundle:Scope')->findAll(); - return $this->render('ChillMainBundle:Scope:index.html.twig', array( + return $this->render('@ChillMain/Scope/index.html.twig', array( 'entities' => $entities, )); } @@ -49,7 +49,7 @@ class ScopeController extends Controller return $this->redirect($this->generateUrl('admin_scope_show', array('id' => $scope->getId()))); } - return $this->render('ChillMainBundle:Scope:new.html.twig', array( + return $this->render('@ChillMain/Scope/new.html.twig', array( 'entity' => $scope, 'form' => $form->createView(), )); @@ -83,7 +83,7 @@ class ScopeController extends Controller $scope = new Scope(); $form = $this->createCreateForm($scope); - return $this->render('ChillMainBundle:Scope:new.html.twig', array( + return $this->render('@ChillMain/Scope/new.html.twig', array( 'entity' => $scope, 'form' => $form->createView(), )); @@ -103,7 +103,7 @@ class ScopeController extends Controller throw $this->createNotFoundException('Unable to find Scope entity.'); } - return $this->render('ChillMainBundle:Scope:show.html.twig', array( + return $this->render('@ChillMain/Scope/show.html.twig', array( 'entity' => $scope )); } @@ -124,7 +124,7 @@ class ScopeController extends Controller $editForm = $this->createEditForm($scope); - return $this->render('ChillMainBundle:Scope:edit.html.twig', array( + return $this->render('@ChillMain/Scope/edit.html.twig', array( 'entity' => $scope, 'edit_form' => $editForm->createView(), )); @@ -171,7 +171,7 @@ class ScopeController extends Controller return $this->redirect($this->generateUrl('admin_scope_edit', array('id' => $id))); } - return $this->render('ChillMainBundle:Scope:edit.html.twig', array( + return $this->render('@ChillMain/Scope/edit.html.twig', array( 'entity' => $scope, 'edit_form' => $editForm->createView() )); diff --git a/Controller/SearchController.php b/Controller/SearchController.php index c71d7b046..70db72ef0 100644 --- a/Controller/SearchController.php +++ b/Controller/SearchController.php @@ -32,7 +32,7 @@ use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\Extension\Core\Type\FormType; use Symfony\Component\HttpFoundation\JsonResponse; use Chill\MainBundle\Search\SearchProvider; -use Symfony\Component\Translation\TranslatorInterface; +use Symfony\Contracts\Translation\TranslatorInterface; use Chill\MainBundle\Pagination\PaginatorFactory; /** @@ -61,7 +61,7 @@ class SearchController extends Controller function __construct( SearchProvider $searchProvider, - TranslatorInterface $translator, + TranslatorInterface $translator, PaginatorFactory $paginatorFactory ) { $this->searchProvider = $searchProvider; @@ -77,7 +77,7 @@ class SearchController extends Controller if ($pattern === ''){ switch($_format) { case 'html': - return $this->render('ChillMainBundle:Search:error.html.twig', + return $this->render('@ChillMain/Search/error.html.twig', array( 'message' => $this->translator->trans("Your search is empty. " . "Please provide search terms."), @@ -129,7 +129,7 @@ class SearchController extends Controller } } } catch (UnknowSearchDomainException $ex) { - return $this->render('ChillMainBundle:Search:error.html.twig', + return $this->render('@ChillMain/Search/error.html.twig', array( "message" => $this->get('translator')->trans("The domain %domain% " . "is unknow. Please check your search.", array('%domain%' => $ex->getDomain())), @@ -138,7 +138,7 @@ class SearchController extends Controller } catch (UnknowSearchNameException $ex) { throw $this->createNotFoundException("The name ".$ex->getName()." is not found"); } catch (ParsingException $ex) { - return $this->render('ChillMainBundle:Search:error.html.twig', + return $this->render('@ChillMain/Search/error.html.twig', array( "message" => $this->translator->trans('Invalid terms'). ": ".$this->translator->trans($ex->getMessage()), @@ -147,7 +147,7 @@ class SearchController extends Controller } - return $this->render('ChillMainBundle:Search:list.html.twig', + return $this->render('@ChillMain/Search/list.html.twig', array('results' => $results, 'pattern' => $pattern) ); } @@ -167,7 +167,7 @@ class SearchController extends Controller ]); } - return $this->render('ChillMainBundle:Search:choose_list.html.twig'); + return $this->render('@ChillMain/Search/choose_list.html.twig'); } public function advancedSearchAction($name, Request $request) @@ -205,7 +205,7 @@ class SearchController extends Controller } } - return $this->render('ChillMainBundle:Search:advanced_search.html.twig', + return $this->render('@ChillMain/Search/advanced_search.html.twig', [ 'form' => $form->createView(), 'name' => $name, diff --git a/Controller/UIController.php b/Controller/UIController.php index 07b3694f8..f12be675a 100644 --- a/Controller/UIController.php +++ b/Controller/UIController.php @@ -32,7 +32,7 @@ class UIController extends Controller ) { $nb = $counter->getSumNotification($this->getUser()); - return $this->render('ChillMainBundle:UI:notification_user_counter.html.twig', [ + return $this->render('@ChillMain/UI/notification_user_counter.html.twig', [ 'nb' => $nb ]); } diff --git a/Controller/UserController.php b/Controller/UserController.php index 83465366a..8ae6750f6 100644 --- a/Controller/UserController.php +++ b/Controller/UserController.php @@ -34,7 +34,7 @@ class UserController extends Controller . 'ORDER BY u.username') ->getResult(); - return $this->render('ChillMainBundle:User:index.html.twig', array( + return $this->render('@ChillMain/User/index.html.twig', array( 'entities' => $entities, )); } @@ -60,7 +60,7 @@ class UserController extends Controller return $this->redirect($this->generateUrl('admin_user_show', array('id' => $user->getId()))); } - return $this->render('ChillMainBundle:User:new.html.twig', array( + return $this->render('@ChillMain/User/new.html.twig', array( 'entity' => $user, 'form' => $form->createView(), )); @@ -95,7 +95,7 @@ class UserController extends Controller $user = new User(); $form = $this->createCreateForm($user); - return $this->render('ChillMainBundle:User:new.html.twig', array( + return $this->render('@ChillMain/User/new.html.twig', array( 'entity' => $user, 'form' => $form->createView(), )); @@ -115,7 +115,7 @@ class UserController extends Controller throw $this->createNotFoundException('Unable to find User entity.'); } - return $this->render('ChillMainBundle:User:show.html.twig', array( + return $this->render('@ChillMain/User/show.html.twig', array( 'entity' => $user, )); } @@ -136,7 +136,7 @@ class UserController extends Controller $editForm = $this->createEditForm($user); - return $this->render('ChillMainBundle:User:edit.html.twig', array( + return $this->render('@ChillMain/User/edit.html.twig', array( 'entity' => $user, 'edit_form' => $editForm->createView(), 'add_groupcenter_form' => $this->createAddLinkGroupCenterForm($user)->createView(), @@ -165,7 +165,7 @@ class UserController extends Controller $editForm = $this->createEditPasswordForm($user); - return $this->render('ChillMainBundle:User:edit_password.html.twig', array( + return $this->render('@ChillMain/User/edit_password.html.twig', array( 'entity' => $user, 'edit_form' => $editForm->createView() )); @@ -256,7 +256,7 @@ class UserController extends Controller } } - return $this->render('ChillMainBundle:User:edit.html.twig', array( + return $this->render('@ChillMain/User/edit.html.twig', array( 'entity' => $user, 'edit_form' => $this->createEditForm($user)->createView(), 'add_groupcenter_form' => $this->createAddLinkGroupCenterForm($user)->createView(), @@ -329,7 +329,7 @@ class UserController extends Controller return $this->redirect($this->generateUrl('admin_user_edit', array('id' => $id))); } - return $this->render('ChillMainBundle:User:edit.html.twig', array( + return $this->render('@ChillMain/User/edit.html.twig', array( 'entity' => $user, 'edit_form' => $editForm->createView(), 'add_groupcenter_form' => $this->createAddLinkGroupCenterForm($user)->createView(), @@ -378,7 +378,7 @@ class UserController extends Controller return $this->redirect($this->generateUrl('admin_user_edit', array('id' => $id))); } - return $this->render('ChillMainBundle:User:edit_password.html.twig', array( + return $this->render('@ChillMain/User/edit_password.html.twig', array( 'entity' => $user, 'edit_form' => $editForm->createView(), )); diff --git a/DependencyInjection/ChillMainExtension.php b/DependencyInjection/ChillMainExtension.php index faede8fc0..af41b2e0a 100644 --- a/DependencyInjection/ChillMainExtension.php +++ b/DependencyInjection/ChillMainExtension.php @@ -144,7 +144,7 @@ class ChillMainExtension extends Extension implements PrependExtensionInterface, 'name' => $config['installation_name']), 'available_languages' => $config['available_languages'] ), - 'form_themes' => array('ChillMainBundle:Form:fields.html.twig') + 'form_themes' => array('@ChillMain/Form/fields.html.twig') ); $container->prependExtensionConfig('twig', $twigConfig); diff --git a/Pagination/ChillPaginationTwig.php b/Pagination/ChillPaginationTwig.php index dcae64ce2..4917216a1 100644 --- a/Pagination/ChillPaginationTwig.php +++ b/Pagination/ChillPaginationTwig.php @@ -34,8 +34,8 @@ use Twig\TwigFunction; */ class ChillPaginationTwig extends AbstractExtension { - const LONG_TEMPLATE = 'ChillMainBundle:Pagination:long.html.twig'; - const SHORT_TEMPLATE = 'ChillMainBundle:Pagination:short.html.twig'; + const LONG_TEMPLATE = '@ChillMain/Pagination/long.html.twig'; + const SHORT_TEMPLATE = '@ChillMain/Pagination/short.html.twig'; public function getName() { @@ -59,7 +59,7 @@ class ChillPaginationTwig extends AbstractExtension public function paginationRender( Environment $env, PaginatorInterface $paginator, - $template = 'ChillMainBundle:Pagination:long.html.twig' + $template = '@ChillMain/Pagination/long.html.twig' ) { switch ($template) { case 'long': diff --git a/Resources/config/services/controller.yml b/Resources/config/services/controller.yml index a62470777..d812117b8 100644 --- a/Resources/config/services/controller.yml +++ b/Resources/config/services/controller.yml @@ -14,6 +14,14 @@ services: Chill\MainBundle\Controller\SearchController: arguments: $searchProvider: '@chill_main.search_provider' - $translator: '@Symfony\Component\Translation\TranslatorInterface' + $translator: '@Symfony\Contracts\Translation\TranslatorInterface' $paginatorFactory: '@Chill\MainBundle\Pagination\PaginatorFactory' tags: ['controller.service_arguments'] + + Chill\MainBundle\Controller\PermissionsGroupController: + arguments: + $translatableStringHelper: '@Chill\MainBundle\Templating\TranslatableStringHelper' + $roleProvider: '@chill.main.role_provider' + $roleHierarchy: '@security.role_hierarchy' + $translator: '@Symfony\Contracts\Translation\TranslatorInterface' + tags: ['controller.service_arguments'] diff --git a/Routing/MenuTwig.php b/Routing/MenuTwig.php index 2464141a0..18cdf5c5d 100644 --- a/Routing/MenuTwig.php +++ b/Routing/MenuTwig.php @@ -54,7 +54,7 @@ class MenuTwig extends AbstractExtension implements ContainerAwareInterface * @var mixed[] */ private $defaultParams = array( - 'layout' => 'ChillMainBundle:Menu:defaultMenu.html.twig', + 'layout' => '@ChillMain/Menu/defaultMenu.html.twig', 'args' => array(), 'activeRouteKey' => null ); diff --git a/Security/RoleProvider.php b/Security/RoleProvider.php index f72435cb1..ced7e584a 100644 --- a/Security/RoleProvider.php +++ b/Security/RoleProvider.php @@ -40,7 +40,9 @@ class RoleProvider * * @var array|null */ - private $rolesTitlesCache = null; + private $rolesTitlesCache = []; + // sf4 check: mis [] au lieu de null + // pour éviter `Warning: array_key_exists() expects parameter 2 to be array, null given` L129 /** * Add a role provider diff --git a/Timeline/TimelineBuilder.php b/Timeline/TimelineBuilder.php index 1c5f364e2..6d061d0a2 100644 --- a/Timeline/TimelineBuilder.php +++ b/Timeline/TimelineBuilder.php @@ -274,7 +274,7 @@ class TimelineBuilder implements ContainerAwareInterface } return $this->container->get('templating') - ->render('ChillMainBundle:Timeline:index.html.twig', array( + ->render('@ChillMain/Timeline/index.html.twig', array( 'results' => $timelineEntries )); diff --git a/templates/Menu/verticalMenu.html.twig b/templates/Menu/verticalMenu.html.twig index 95bfb956f..398f84c31 100644 --- a/templates/Menu/verticalMenu.html.twig +++ b/templates/Menu/verticalMenu.html.twig @@ -26,11 +26,11 @@ {% block v_menu_title %}{% endblock %} {% for route in routes %} -
  • + {% endapply %} "> {{ route.label|trans }}
  • {% endfor %}