From 3e4570c2fa1e29e6f4bd855792ac634ea697d3fe Mon Sep 17 00:00:00 2001 From: Kendrick Chan Date: Fri, 7 Jun 2019 00:15:58 +0800 Subject: [PATCH 01/13] Add initial menu bundle #222 --- catalyst/menu-bundle/CatalystMenuBundle.php | 10 ++++++++++ composer.json | 1 + config/bundles.php | 1 + 3 files changed, 12 insertions(+) create mode 100644 catalyst/menu-bundle/CatalystMenuBundle.php diff --git a/catalyst/menu-bundle/CatalystMenuBundle.php b/catalyst/menu-bundle/CatalystMenuBundle.php new file mode 100644 index 00000000..ca8353dc --- /dev/null +++ b/catalyst/menu-bundle/CatalystMenuBundle.php @@ -0,0 +1,10 @@ + ['dev' => true, 'test' => true], Catalyst\APIBundle\CatalystAPIBundle::class => ['all' => true], Catalyst\AuthBundle\CatalystAuthBundle::class => ['all' => true], + Catalyst\MenuBundle\CatalystMenuBundle::class => ['all' => true], ]; From fa9bbe89897d9c36104b8c678656e54af06cea33 Mon Sep 17 00:00:00 2001 From: Kendrick Chan Date: Fri, 7 Jun 2019 01:21:46 +0800 Subject: [PATCH 02/13] Create Menu annotation and listener #222 --- catalyst/menu-bundle/Annotation/Menu.php | 13 ++++ .../Listener/MenuAnnotationListener.php | 77 +++++++++++++++++++ config/services.yaml | 6 ++ 3 files changed, 96 insertions(+) create mode 100644 catalyst/menu-bundle/Annotation/Menu.php create mode 100644 catalyst/menu-bundle/Listener/MenuAnnotationListener.php diff --git a/catalyst/menu-bundle/Annotation/Menu.php b/catalyst/menu-bundle/Annotation/Menu.php new file mode 100644 index 00000000..e8001aeb --- /dev/null +++ b/catalyst/menu-bundle/Annotation/Menu.php @@ -0,0 +1,13 @@ +annot_reader = $annot_reader; + $this->menu_gen = $menu_gen; + $this->twig = $twig; + $this->menu_name = $menu_name; + } + + public function onKernelController(FilterControllerEvent $event) + { + if (!$event->isMasterRequest()) + return; + + // get controller + $event_controller = $event->getController(); + if (!is_array($event_controller)) + return; + + list($controller, $method_name) = $event_controller; + + // get reflection class + try + { + $ref_controller = new ReflectionClass($controller); + } + catch (ReflectionException $e) + { + throw new RuntimeException('Cannot read menu annotation.'); + } + + // get method annotations + $ref_method = $ref_controller->getMethod($method_name); + $annotation = $this->annot_reader->getMethodAnnotation($ref_method, MenuAnnotation::class); + + // check if we get anything + if ($annotation == null) + return; + + $this->selectMenu($annotation->selected); + } + + protected function selectMenu($selected) + { + // get menu + $menu = $this->menu_gen->getMenu($this->menu_name); + + // set menu selected + $sel = $menu['index']->get($selected); + if ($sel != null) + $sel->setSelected(); + + // create twig global variable + $this->twig->addGlobal($this->menu_name, $menu); + } +} diff --git a/config/services.yaml b/config/services.yaml index 83d03a2a..487d8d13 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -118,4 +118,10 @@ services: $cache_dir: "%kernel.cache_dir%" $config_dir: "%kernel.root_dir%/../config" $acl_file: "%api_acl_file%" + + Catalyst\MenuBundle\Listener\MenuAnnotationListener: + arguments: + $menu_name: "main_menu" + tags: + - { name: kernel.event_listener, event: kernel.controller, method: onKernelController } From 841011d3d01a888dd1640278f2d21efff6d1f241 Mon Sep 17 00:00:00 2001 From: Kendrick Chan Date: Fri, 7 Jun 2019 01:22:09 +0800 Subject: [PATCH 03/13] Convert HomeController to use Menu annotation instead of base controller #222 --- src/Controller/HomeController.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Controller/HomeController.php b/src/Controller/HomeController.php index 442d0e8c..96380a23 100644 --- a/src/Controller/HomeController.php +++ b/src/Controller/HomeController.php @@ -2,14 +2,16 @@ namespace App\Controller; -use App\Ramcar\BaseController; +use Catalyst\MenuBundle\Annotation\Menu; +use Symfony\Bundle\FrameworkBundle\Controller\Controller; -class HomeController extends BaseController +class HomeController extends Controller { + /** + * @Menu(selected="home") + */ public function index() { - $params = $this->initParameters('home'); - - return $this->render('home.html.twig', $params); + return $this->render('home.html.twig'); } } From 682bf7ede26a8e88c769b4eb02e5a92c509c99de Mon Sep 17 00:00:00 2001 From: Kendrick Chan Date: Fri, 7 Jun 2019 01:48:37 +0800 Subject: [PATCH 04/13] Copy over menu classes from main app #222 --- catalyst/menu-bundle/Menu/Collection.php | 71 ++++++++++ catalyst/menu-bundle/Menu/Generator.php | 164 +++++++++++++++++++++++ catalyst/menu-bundle/Menu/Item.php | 138 +++++++++++++++++++ 3 files changed, 373 insertions(+) create mode 100644 catalyst/menu-bundle/Menu/Collection.php create mode 100644 catalyst/menu-bundle/Menu/Generator.php create mode 100644 catalyst/menu-bundle/Menu/Item.php diff --git a/catalyst/menu-bundle/Menu/Collection.php b/catalyst/menu-bundle/Menu/Collection.php new file mode 100644 index 00000000..2ddfc50d --- /dev/null +++ b/catalyst/menu-bundle/Menu/Collection.php @@ -0,0 +1,71 @@ +position = 0; + $this->array = array(); + $this->index_array = array(); + } + + // iterator stuff + public function rewind() + { + $this->position = 0; + } + + public function current() + { + return $this->array[$this->index_array[$this->position]]; + } + + public function key() + { + return $this->position; + } + + public function next() + { + return ++$this->position; + } + + public function valid() + { + return isset($this->index_array[$this->position]); + } + // end of iterator stuff + + public function add(Item $mi) + { + $id = $mi->getID(); + $this->array[$id] = $mi; + $this->index_array[] = $id; + return $this; + } + + public function get($id) + { + if (isset($this->array[$id])) + return $this->array[$id]; + + return null; + } + + public function unselectAll() + { + foreach ($this->array as $mi) + $mi->setSelected(false, false); + + return $this; + } +} diff --git a/catalyst/menu-bundle/Menu/Generator.php b/catalyst/menu-bundle/Menu/Generator.php new file mode 100644 index 00000000..eba63ab1 --- /dev/null +++ b/catalyst/menu-bundle/Menu/Generator.php @@ -0,0 +1,164 @@ +index = new Collection(); + $this->menu = new Collection(); + $this->router = $router; + $this->cache_dir = $cache_dir; + $this->config_dir = $config_dir; + $this->config_file = $config_file; + } + + public function getMenu($menu_key) + { + // initialize + $menu_data = [ + 'menu' => [], + 'index' => [] + ]; + + // cache config + $cache_file = $this->cache_dir . '/' . $this->config_file . '.' . $menu_key . '.serial'; + $menu_cache = new ConfigCache($cache_file, true); + + // cache not fresh + if (!$menu_cache->isFresh()) + { + $files = []; + $resources = []; + + try + { + // get location of menu config file + $path = $this->config_dir . '/' . $this->config_file; + $files[] = $path; + $resources[] = new FileResource($path); + + // TODO: handle routes changes as well + // NOTE: need to figure out how to handle route changes or require + // a cache clear for every route change + + // process bundle menu + $this->parseMenu($path, $menu_key); + } + catch (\InvalidArgumentException $e) + { + error_log($e->getMessage()); + error_log($menu_key . ' menu not found.'); + return $menu_data; + } + + $menu_data = [ + 'menu' => $this->menu, + 'index' => $this->index, + ]; + $menu_serial = serialize($menu_data); + $menu_cache->write($menu_serial, $resources); + } + else + { + $menu_serial = file_get_contents($cache_file); + $menu_data = unserialize($menu_serial); + $this->menu = $menu_data['menu']; + $this->index = $menu_data['index']; + } + + return $menu_data; + } + + protected function parseMenu($path, $menu_key) + { + $parser = new YamlParser(); + $menu_config = $parser->parse(file_get_contents($path)); + + // check if we have menu items + if (!isset($menu_config[$menu_key])) + { + error_log('No ' . $menu_key . ' found for ' . $path); + return; + } + + // go through each one + foreach ($menu_config[$menu_key] as $mi_data) + { + // check params + if (!isset($mi_data['icon'])) + $mi_data['icon'] = null; + + // instantiate + $mi = $this->newItem($mi_data['id'], $mi_data['label'], $mi_data['icon']); + + // acl + if (isset($mi_data['acl'])) + $mi->setACLKey($mi_data['acl']); + + // check parent + if (isset($mi_data['parent']) && $mi_data['parent'] != null) + { + $parent = $this->index->get($mi_data['parent']); + if ($parent == null) + continue; + + $parent->addChild($mi); + } + else + $this->menu->add($mi); + + } + } + + protected function newItem($id, $label, $icon = null) + { + $mi = new Item(); + $mi->setID($id) + ->setLabel($label); + + try + { + $mi->setLink($this->router->generate($id)); + } + catch (RouteNotFoundException $e) + { + // no route, set to # + $mi->setLink('#'); + } + + if ($icon != null) + $mi->setIcon($icon); + + $this->index->add($mi); + + return $mi; + } + + public function generate() + { + $this->getAllBundleMenus(); + + return $this->menu; + } + + public function getIndex() + { + return $this->index; + } +} diff --git a/catalyst/menu-bundle/Menu/Item.php b/catalyst/menu-bundle/Menu/Item.php new file mode 100644 index 00000000..14e178f0 --- /dev/null +++ b/catalyst/menu-bundle/Menu/Item.php @@ -0,0 +1,138 @@ +id = ''; + $this->icon = null; + $this->link = null; + $this->label = ''; + $this->children = []; + $this->selected = false; + $this->parent = null; + $this->acl_key = null; + } + + // setters + public function setID($id) + { + $this->id = $id; + return $this; + } + + public function setIcon($icon) + { + $this->icon = $icon; + return $this; + } + + public function setLink($link) + { + $this->link = $link; + return $this; + } + + public function setLabel($label) + { + $this->label = $label; + return $this; + } + + public function setParent(self $parent) + { + $this->parent = $parent; + return $this; + } + + public function addChild(self $child) + { + $child->setParent($this); + + // check if selected + if ($child->isSelected()) + $this->setSelected(); + + $this->children[] = $child; + return $this; + } + + public function setSelected($sel = true, $to_bubble = true) + { + if ($sel) + { + $this->selected = true; + // bubble up to parents + if ($this->parent != null && $to_bubble) + $this->parent->setSelected(true, true); + } + else + $this->selected = false; + return $this; + } + + public function setACLKey($key) + { + $this->acl_key = $key; + return $this; + } + + // getters + public function getID() + { + return $this->id; + } + + public function getIcon() + { + return $this->icon; + } + + public function getLink() + { + return $this->link; + } + + public function getLabel() + { + return $this->label; + } + + public function getChildren() + { + return $this->children; + } + + public function hasChildren() + { + if (count($this->children) > 0) + return true; + return false; + } + + public function isSelected() + { + return $this->selected; + } + + public function getParent() + { + return $this->parent; + } + + public function getACLKey() + { + return $this->acl_key; + } +} From 915cb6ba8deb9bb94e5c9038b62a7e6f18f08cb2 Mon Sep 17 00:00:00 2001 From: Kendrick Chan Date: Fri, 7 Jun 2019 01:49:01 +0800 Subject: [PATCH 05/13] Add generator service from menu bundle #222 --- catalyst/menu-bundle/Listener/MenuAnnotationListener.php | 5 ++--- config/services.yaml | 6 ++++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/catalyst/menu-bundle/Listener/MenuAnnotationListener.php b/catalyst/menu-bundle/Listener/MenuAnnotationListener.php index b6755e26..2ad6b04c 100644 --- a/catalyst/menu-bundle/Listener/MenuAnnotationListener.php +++ b/catalyst/menu-bundle/Listener/MenuAnnotationListener.php @@ -7,11 +7,10 @@ use ReflectionClass; use ReflectionException; use RuntimeException; use Symfony\Component\HttpKernel\Event\FilterControllerEvent; -use Catalyst\MenuBundle\Annotation\Menu as MenuAnnotation; use Twig\Environment as TwigEnvironment; -// TODO: put the generator in our bundle -use App\Menu\Generator as MenuGenerator; +use Catalyst\MenuBundle\Annotation\Menu as MenuAnnotation; +use Catalyst\MenuBundle\Menu\Generator as MenuGenerator; class MenuAnnotationListener { diff --git a/config/services.yaml b/config/services.yaml index 487d8d13..2fc3301d 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -119,6 +119,12 @@ services: $config_dir: "%kernel.root_dir%/../config" $acl_file: "%api_acl_file%" + Catalyst\MenuBundle\Menu\Generator: + arguments: + $router: "@router.default" + $cache_dir: "%kernel.cache_dir%" + $config_dir: "%kernel.root_dir%/../config" + Catalyst\MenuBundle\Listener\MenuAnnotationListener: arguments: $menu_name: "main_menu" From 3d1a1c3173a19abc21a3f86dd3728c34aaaa3047 Mon Sep 17 00:00:00 2001 From: Kendrick Chan Date: Fri, 7 Jun 2019 02:03:30 +0800 Subject: [PATCH 06/13] Convert HubController to use Menu annotation instead of base controller #222 --- config/services.yaml | 1 - src/Controller/HubController.php | 24 ++++++++++++++++-------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/config/services.yaml b/config/services.yaml index 2fc3301d..8c8024f5 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -130,4 +130,3 @@ services: $menu_name: "main_menu" tags: - { name: kernel.event_listener, event: kernel.controller, method: onKernelController } - diff --git a/src/Controller/HubController.php b/src/Controller/HubController.php index 5d361eee..8e4feac5 100644 --- a/src/Controller/HubController.php +++ b/src/Controller/HubController.php @@ -11,19 +11,24 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface; use Symfony\Component\Validator\Validator\ValidatorInterface; +use Symfony\Bundle\FrameworkBundle\Controller\Controller; use CrEOF\Spatial\PHP\Types\Geometry\Point; use DateTime; +use Catalyst\MenuBundle\Annotation\Menu; + + class HubController extends BaseController { + /** + * @Menu(selected="hub_list") + */ public function index() { $this->denyAccessUnlessGranted('hub.list', null, 'No access.'); - $params = $this->initParameters('hub_list'); - - return $this->render('hub/list.html.twig', $params); + return $this->render('hub/list.html.twig'); } public function rows(Request $req) @@ -112,11 +117,14 @@ class HubController extends BaseController ]); } + /** + * @Menu(selected="hub_list") + */ public function addForm() { $this->denyAccessUnlessGranted('hub.add', null, 'No access.'); - $params = $this->initParameters('hub_list'); + $params = []; $params['obj'] = new Hub(); $params['mode'] = 'create'; @@ -195,12 +203,13 @@ class HubController extends BaseController ]); } + /** + * @Menu(selected="hub_list") + */ public function updateForm($id) { $this->denyAccessUnlessGranted('hub.update', null, 'No access.'); - $params = $this->initParameters('hub_list'); - // get row data $em = $this->getDoctrine()->getManager(); $obj = $em->getRepository(Hub::class)->find($id); @@ -209,6 +218,7 @@ class HubController extends BaseController if (empty($obj)) throw $this->createNotFoundException('The item does not exist'); + $params = []; $params['obj'] = $obj; $params['mode'] = 'update'; @@ -263,8 +273,6 @@ class HubController extends BaseController { $this->denyAccessUnlessGranted('hub.delete', null, 'No access.'); - $params = $this->initParameters('hub_list'); - // get objext data $em = $this->getDoctrine()->getManager(); $obj = $em->getRepository(Hub::class)->find($id); From bd3b3df713b8b75b08f304bc90729d2c953eb574 Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Fri, 7 Jun 2019 02:17:30 +0000 Subject: [PATCH 07/13] Convert the controllers for battery, APIUser, battery manufacturer, and battery model to use the Menu annotation. #222 --- src/Controller/APIUserController.php | 25 ++++++++++----- src/Controller/BatteryController.php | 32 +++++++++---------- .../BatteryManufacturerController.php | 32 +++++++++---------- src/Controller/BatteryModelController.php | 28 +++++++++------- src/Controller/HubController.php | 6 ++-- 5 files changed, 67 insertions(+), 56 deletions(-) diff --git a/src/Controller/APIUserController.php b/src/Controller/APIUserController.php index 250880c6..91abe141 100644 --- a/src/Controller/APIUserController.php +++ b/src/Controller/APIUserController.php @@ -12,16 +12,20 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface; use Symfony\Component\Validator\Validator\ValidatorInterface; +use Symfony\Bundle\FrameworkBundle\Controller\Controller; -class APIUserController extends BaseController +use Catalyst\MenuBundle\Annotation\Menu; + +class APIUserController extends Controller { + /** + * @Menu(selected="api_user_list") + */ public function index() { $this->denyAccessUnlessGranted('apiuser.list', null, 'No access.'); - $params = $this->initParameters('api_user_list'); - - return $this->render('api-user/list.html.twig', $params); + return $this->render('api-user/list.html.twig'); } public function rows(Request $req) @@ -120,11 +124,13 @@ class APIUserController extends BaseController ]); } + /** + * @Menu(selected="api_user_list") + */ public function addForm() { $this->denyAccessUnlessGranted('apiuser.add', null, 'No access.'); - $params = $this->initParameters('api_user_list'); $params['obj'] = new APIUser(); $params['mode'] = 'create'; @@ -198,11 +204,13 @@ class APIUserController extends BaseController } } + /** + * @Menu(selected="api_user_list") + */ public function updateForm($id) { $this->denyAccessUnlessGranted('apiuser.update', null, 'No access.'); - $params = $this->initParameters('api_ser_list'); $params['mode'] = 'update'; // get row data @@ -281,12 +289,13 @@ class APIUserController extends BaseController } } + /** + * @Menu(selected="api_user_list") + */ public function destroy($id) { $this->denyAccessUnlessGranted('apiuser.delete', null, 'No access.'); - $params = $this->initParameters('api_user_list'); - // get row data $em = $this->getDoctrine()->getManager(); $obj = $em->getRepository(APIUser::class)->find($id); diff --git a/src/Controller/BatteryController.php b/src/Controller/BatteryController.php index c242a9b6..e2837623 100644 --- a/src/Controller/BatteryController.php +++ b/src/Controller/BatteryController.php @@ -2,7 +2,6 @@ namespace App\Controller; -use App\Ramcar\BaseController; use App\Entity\Battery; use App\Entity\BatteryManufacturer; use App\Entity\BatteryModel; @@ -15,24 +14,20 @@ use Doctrine\ORM\Query; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Validator\Validator\ValidatorInterface; +use Symfony\Bundle\FrameworkBundle\Controller\Controller; -use App\Menu\Generator as MenuGenerator; +use Catalyst\MenuBundle\Annotation\Menu; -class BatteryController extends BaseController +class BatteryController extends Controller { - public function __construct(MenuGenerator $menu_gen) - { - parent::__construct($menu_gen); - } - + /** + * @Menu(selected="battery_list") + */ public function index() { $this->denyAccessUnlessGranted('battery.list', null, 'No access.'); - $params = $this->initParameters('battery_list'); - - // response - return $this->render('battery/list.html.twig', $params); + return $this->render('battery/list.html.twig'); } public function rows(Request $req) @@ -145,11 +140,13 @@ class BatteryController extends BaseController ]); } + /** + * @Menu(selected="battery_list") + */ public function addForm() { $this->denyAccessUnlessGranted('battery.add', null, 'No access.'); - $params = $this->initParameters('battery_list'); $params['obj'] = new Battery(); $params['mode'] = 'create'; @@ -257,11 +254,13 @@ class BatteryController extends BaseController } } + /** + * @Menu(selected="battery_list") + */ public function updateForm($id) { $this->denyAccessUnlessGranted('battery.update', null, 'No access.'); - $params = $this->initParameters('battery_list'); $params['mode'] = 'update'; // get row data @@ -380,12 +379,13 @@ class BatteryController extends BaseController } } + /** + * @Menu(selected="battery_list") + */ public function destroy($id) { $this->denyAccessUnlessGranted('battery.delete', null, 'No access.'); - $params = $this->initParameters('battery_list'); - // get row data $em = $this->getDoctrine()->getManager(); $row = $em->getRepository(Battery::class)->find($id); diff --git a/src/Controller/BatteryManufacturerController.php b/src/Controller/BatteryManufacturerController.php index f0461f44..3090ccf9 100644 --- a/src/Controller/BatteryManufacturerController.php +++ b/src/Controller/BatteryManufacturerController.php @@ -2,7 +2,6 @@ namespace App\Controller; -use App\Ramcar\BaseController; use App\Entity\BatteryManufacturer; use App\Entity\Vehicle; use App\Entity\Battery; @@ -11,24 +10,20 @@ use Doctrine\ORM\Query; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Validator\Validator\ValidatorInterface; +use Symfony\Bundle\FrameworkBundle\Controller\Controller; -use App\Menu\Generator as MenuGenerator; +use Catalyst\MenuBundle\Annotation\Menu; -class BatteryManufacturerController extends BaseController +class BatteryManufacturerController extends Controller { - public function __construct(MenuGenerator $menu_gen) - { - parent::__construct($menu_gen); - } - + /** + * @Menu(selected="bmfg_list") + */ public function index() { $this->denyAccessUnlessGranted('bmfg.list', null, 'No access.'); - $params = $this->initParameters('bmfg_list'); - - // response - return $this->render('battery-manufacturer/list.html.twig', $params); + return $this->render('battery-manufacturer/list.html.twig'); } public function rows(Request $req) @@ -123,11 +118,13 @@ class BatteryManufacturerController extends BaseController ]); } + /** + * @Menu(selected="bmfg_list") + */ public function addForm() { $this->denyAccessUnlessGranted('bmfg.add', null, 'No access.'); - $params = $this->initParameters('bmfg_list'); $params['obj'] = new BatteryManufacturer(); $params['mode'] = 'create'; @@ -176,11 +173,13 @@ class BatteryManufacturerController extends BaseController } } + /** + * @Menu(selected="bmfg_list") + */ public function updateForm($id) { $this->denyAccessUnlessGranted('bmfg.update', null, 'No access.'); - $params = $this->initParameters('bmfg_list'); $params['mode'] = 'update'; // get row data @@ -241,12 +240,13 @@ class BatteryManufacturerController extends BaseController } } + /** + * @Menu(selected="bmfg_list") + */ public function destroy($id) { $this->denyAccessUnlessGranted('bmfg.delete', null, 'No access.'); - $params = $this->initParameters('bmfg_list'); - // get row data $em = $this->getDoctrine()->getManager(); $row = $em->getRepository(BatteryManufacturer::class)->find($id); diff --git a/src/Controller/BatteryModelController.php b/src/Controller/BatteryModelController.php index 81eaa40a..dcf1a46e 100644 --- a/src/Controller/BatteryModelController.php +++ b/src/Controller/BatteryModelController.php @@ -9,24 +9,23 @@ use Doctrine\ORM\Query; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Validator\Validator\ValidatorInterface; +use Symfony\Bundle\FrameworkBundle\Controller\Controller; + +use Catalyst\MenuBundle\Annotation\Menu; use App\Menu\Generator as MenuGenerator; class BatteryModelController extends BaseController { - public function __construct(MenuGenerator $menu_gen) - { - parent::__construct($menu_gen); - } - + /** + * @Menu(selected="bmodel_list") + */ public function index() { $this->denyAccessUnlessGranted('bmodel.list', null, 'No access.'); - $params = $this->initParameters('bmodel_list'); - // response - return $this->render('battery-model/list.html.twig', $params); + return $this->render('battery-model/list.html.twig'); } public function rows(Request $req) @@ -115,11 +114,13 @@ class BatteryModelController extends BaseController ]); } + /** + * @Menu(selected="bmodel_list") + */ public function addForm() { $this->denyAccessUnlessGranted('bmodel.add', null, 'No access.'); - $params = $this->initParameters('bmodel_list'); $params['obj'] = new BatteryModel(); $params['mode'] = 'create'; @@ -168,11 +169,13 @@ class BatteryModelController extends BaseController } } + /** + * @Menu(selected="bmodel_list") + */ public function updateForm($id) { $this->denyAccessUnlessGranted('bmodel.update', null, 'No access.'); - $params = $this->initParameters('bmodel_list'); $params['mode'] = 'update'; // get row data @@ -233,12 +236,13 @@ class BatteryModelController extends BaseController } } + /** + * @Menu(selected="bmodel_list") + */ public function destroy($id) { $this->denyAccessUnlessGranted('bmodel.delete', null, 'No access.'); - $params = $this->initParameters('bmodel_list'); - // get row data $em = $this->getDoctrine()->getManager(); $row = $em->getRepository(BatteryModel::class)->find($id); diff --git a/src/Controller/HubController.php b/src/Controller/HubController.php index 8e4feac5..eb1faa73 100644 --- a/src/Controller/HubController.php +++ b/src/Controller/HubController.php @@ -2,7 +2,6 @@ namespace App\Controller; -use App\Ramcar\BaseController; use App\Entity\Hub; use Doctrine\ORM\Query; @@ -18,8 +17,7 @@ use DateTime; use Catalyst\MenuBundle\Annotation\Menu; - -class HubController extends BaseController +class HubController extends Controller { /** * @Menu(selected="hub_list") @@ -273,7 +271,7 @@ class HubController extends BaseController { $this->denyAccessUnlessGranted('hub.delete', null, 'No access.'); - // get objext data + // get object data $em = $this->getDoctrine()->getManager(); $obj = $em->getRepository(Hub::class)->find($id); From 0925dbd574bf5d4bc8eb7c30a2711c3b3431192f Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Fri, 7 Jun 2019 08:18:01 +0000 Subject: [PATCH 08/13] Remove annotations from destroy methods of battery, battery manufacturer, battery model, and api user since not needed. Add annotations for battery size, customer, geofence, and job order. #222 --- src/Controller/APIUserController.php | 3 - src/Controller/BatteryController.php | 3 - .../BatteryManufacturerController.php | 3 - src/Controller/BatteryModelController.php | 8 +-- src/Controller/BatterySizeController.php | 29 ++++---- src/Controller/CustomerController.php | 29 ++++---- src/Controller/GeofenceController.php | 17 +++-- src/Controller/JobOrderController.php | 72 +++++++++++++------ 8 files changed, 86 insertions(+), 78 deletions(-) diff --git a/src/Controller/APIUserController.php b/src/Controller/APIUserController.php index 91abe141..077f4064 100644 --- a/src/Controller/APIUserController.php +++ b/src/Controller/APIUserController.php @@ -289,9 +289,6 @@ class APIUserController extends Controller } } - /** - * @Menu(selected="api_user_list") - */ public function destroy($id) { $this->denyAccessUnlessGranted('apiuser.delete', null, 'No access.'); diff --git a/src/Controller/BatteryController.php b/src/Controller/BatteryController.php index e2837623..059d8b57 100644 --- a/src/Controller/BatteryController.php +++ b/src/Controller/BatteryController.php @@ -379,9 +379,6 @@ class BatteryController extends Controller } } - /** - * @Menu(selected="battery_list") - */ public function destroy($id) { $this->denyAccessUnlessGranted('battery.delete', null, 'No access.'); diff --git a/src/Controller/BatteryManufacturerController.php b/src/Controller/BatteryManufacturerController.php index 3090ccf9..ad93d3df 100644 --- a/src/Controller/BatteryManufacturerController.php +++ b/src/Controller/BatteryManufacturerController.php @@ -240,9 +240,6 @@ class BatteryManufacturerController extends Controller } } - /** - * @Menu(selected="bmfg_list") - */ public function destroy($id) { $this->denyAccessUnlessGranted('bmfg.delete', null, 'No access.'); diff --git a/src/Controller/BatteryModelController.php b/src/Controller/BatteryModelController.php index dcf1a46e..ffdfc25a 100644 --- a/src/Controller/BatteryModelController.php +++ b/src/Controller/BatteryModelController.php @@ -2,7 +2,6 @@ namespace App\Controller; -use App\Ramcar\BaseController; use App\Entity\BatteryModel; use Doctrine\ORM\Query; @@ -13,9 +12,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Catalyst\MenuBundle\Annotation\Menu; -use App\Menu\Generator as MenuGenerator; - -class BatteryModelController extends BaseController +class BatteryModelController extends Controller { /** * @Menu(selected="bmodel_list") @@ -236,9 +233,6 @@ class BatteryModelController extends BaseController } } - /** - * @Menu(selected="bmodel_list") - */ public function destroy($id) { $this->denyAccessUnlessGranted('bmodel.delete', null, 'No access.'); diff --git a/src/Controller/BatterySizeController.php b/src/Controller/BatterySizeController.php index d9eb82d2..5dc2906a 100644 --- a/src/Controller/BatterySizeController.php +++ b/src/Controller/BatterySizeController.php @@ -2,31 +2,26 @@ namespace App\Controller; -use App\Ramcar\BaseController; use App\Entity\BatterySize; use Doctrine\ORM\Query; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Validator\Validator\ValidatorInterface; +use Symfony\Bundle\FrameworkBundle\Controller\Controller; -use App\Menu\Generator as MenuGenerator; +use Catalyst\MenuBundle\Annotation\Menu; -class BatterySizeController extends BaseController +class BatterySizeController extends Controller { - public function __construct(MenuGenerator $menu_gen) - { - parent::__construct($menu_gen); - } - + /** + * @Menu(selected="bsize_list") + */ public function index() { $this->denyAccessUnlessGranted('bsize.list', null, 'No access.'); - $params = $this->initParameters('bsize_list'); - - // response - return $this->render('battery-size/list.html.twig', $params); + return $this->render('battery-size/list.html.twig'); } public function rows(Request $req) @@ -115,11 +110,13 @@ class BatterySizeController extends BaseController ]); } + /** + * @Menu(selected="bsize_list") + */ public function addForm() { $this->denyAccessUnlessGranted('bsize.add', null, 'No access.'); - $params = $this->initParameters('bsize_list'); $params['obj'] = new BatterySize(); $params['mode'] = 'create'; @@ -176,11 +173,13 @@ class BatterySizeController extends BaseController } } + /** + * @Menu(selected="bsize_list") + */ public function updateForm($id) { $this->denyAccessUnlessGranted('bsize.update', null, 'No access.'); - $params = $this->initParameters('bsize_list'); $params['mode'] = 'update'; // get row data @@ -245,8 +244,6 @@ class BatterySizeController extends BaseController { $this->denyAccessUnlessGranted('bsize.delete', null, 'No access.'); - $params = $this->initParameters('bsize_list'); - // get row data $em = $this->getDoctrine()->getManager(); $row = $em->getRepository(BatterySize::class)->find($id); diff --git a/src/Controller/CustomerController.php b/src/Controller/CustomerController.php index 21d928a3..d03d735a 100644 --- a/src/Controller/CustomerController.php +++ b/src/Controller/CustomerController.php @@ -2,7 +2,6 @@ namespace App\Controller; -use App\Ramcar\BaseController; use App\Ramcar\CustomerClassification; use App\Ramcar\FuelType; use App\Ramcar\VehicleStatusCondition; @@ -20,26 +19,22 @@ use Doctrine\ORM\Query; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Validator\Validator\ValidatorInterface; +use Symfony\Bundle\FrameworkBundle\Controller\Controller; -use App\Menu\Generator as MenuGenerator; +use Catalyst\MenuBundle\Annotation\Menu; use DateTime; -class CustomerController extends BaseController +class CustomerController extends Controller { - public function __construct(MenuGenerator $menu_gen) - { - parent::__construct($menu_gen); - } - + /** + * @Menu(selected="customer_list") + */ public function index() { $this->denyAccessUnlessGranted('customer.list', null, 'No access.'); - $params = $this->initParameters('customer_list'); - - // response - return $this->render('customer/list.html.twig', $params); + return $this->render('customer/list.html.twig'); } public function rows(Request $req) @@ -159,11 +154,13 @@ class CustomerController extends BaseController $params['batteries'] = $em->getRepository(Battery::class)->findAll(); } + /** + * @Menu(selected="customer_list") + */ public function addForm() { $this->denyAccessUnlessGranted('customer.add', null, 'No access.'); - $params = $this->initParameters('customer_list'); $params['obj'] = new Customer(); $params['mode'] = 'create'; @@ -303,11 +300,13 @@ class CustomerController extends BaseController } } + /** + * @Menu(selected="customer_list") + */ public function updateForm($id) { $this->denyAccessUnlessGranted('customer.update', null, 'No access.'); - $params = $this->initParameters('customer_list'); $params['mode'] = 'update'; // get row data @@ -471,8 +470,6 @@ class CustomerController extends BaseController { $this->denyAccessUnlessGranted('customer.delete', null, 'No access.'); - $params = $this->initParameters('customer_list'); - // get row data $em = $this->getDoctrine()->getManager(); $row = $em->getRepository(Customer::class)->find($id); diff --git a/src/Controller/GeofenceController.php b/src/Controller/GeofenceController.php index 8c25983c..48cc5e43 100644 --- a/src/Controller/GeofenceController.php +++ b/src/Controller/GeofenceController.php @@ -2,7 +2,6 @@ namespace App\Controller; -use App\Ramcar\BaseController; use App\Entity\SupportedArea; use App\Service\KMLFileImporter; @@ -14,18 +13,22 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface; use Symfony\Component\Validator\Validator\ValidatorInterface; +use Symfony\Bundle\FrameworkBundle\Controller\Controller; + +use Catalyst\MenuBundle\Annotation\Menu; use CrEOF\Spatial\PHP\Types\Geometry\Point; use DateTime; -class GeofenceController extends BaseController +class GeofenceController extends Controller { + /** + * @Menu(selected="geofence_list") + */ public function index() { $this->denyAccessUnlessGranted('geofence.list', null, 'No access.'); - $params = $this->initParameters('geofence_list'); - $params['areas'] = $this->getDoctrine() ->getRepository(SupportedArea::class) ->findAll();; @@ -33,11 +36,13 @@ class GeofenceController extends BaseController return $this->render('geofence/list.html.twig', $params); } + /** + * @Menu(selected="geofence_list") + */ public function addForm() { $this->denyAccessUnlessGranted('geofence.add', null, 'No access.'); - $params = $this->initParameters('geofence_list'); $params['obj'] = new SupportedArea(); // response @@ -67,8 +72,6 @@ class GeofenceController extends BaseController { $this->denyAccessUnlessGranted('geofence.delete', null, 'No access.'); - $params = $this->initParameters('geofence_list'); - // get object data $em = $this->getDoctrine()->getManager(); $obj = $em->getRepository(SupportedArea::class)->find($id); diff --git a/src/Controller/JobOrderController.php b/src/Controller/JobOrderController.php index 3a5a8efa..8e1afedd 100644 --- a/src/Controller/JobOrderController.php +++ b/src/Controller/JobOrderController.php @@ -2,7 +2,6 @@ namespace App\Controller; -use App\Ramcar\BaseController; use App\Ramcar\ServiceType; use App\Ramcar\JOStatus; use App\Ramcar\WarrantyClass; @@ -42,6 +41,9 @@ use Doctrine\ORM\PessimisticLockException; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Validator\Validator\ValidatorInterface; +use Symfony\Bundle\FrameworkBundle\Controller\Controller; + +use Catalyst\MenuBundle\Annotation\Menu; use CrEOF\Spatial\PHP\Types\Geometry\Point; @@ -51,7 +53,7 @@ use DateInterval; use FPDF; -class JobOrderController extends BaseController +class JobOrderController extends Controller { public function getJobOrders(Request $req) { @@ -201,11 +203,13 @@ class JobOrderController extends BaseController } } + /** + * @Menu(selected="jo_in") + */ public function incomingForm() { $this->denyAccessUnlessGranted('jo_in.list', null, 'No access.'); - $params = $this->initParameters('jo_in'); $params['obj'] = new JobOrder(); $params['mode'] = 'create'; $params['submit_url'] = $this->generateUrl('jo_in_submit'); @@ -220,6 +224,9 @@ class JobOrderController extends BaseController return $this->render('job-order/form.html.twig', $params); } + /** + * @Menu(selected="jo_in") + */ public function openEditForm($id) { $this->denyAccessUnlessGranted('jo_open.edit', null, 'No access.'); @@ -227,8 +234,6 @@ class JobOrderController extends BaseController $em = $this->getDoctrine()->getManager(); $jo = $em->getRepository(JobOrder::class)->find($id); - - $params = $this->initParameters('jo_in'); $params['obj'] = $jo; $params['mode'] = 'open_edit'; $params['submit_url'] = $this->generateUrl('jo_open_edit_submit', ['id' => $id]); @@ -382,11 +387,13 @@ class JobOrderController extends BaseController ]); } + /** + * @Menu(selected="jo_in") + */ public function incomingVehicleForm($cvid) { $this->denyAccessUnlessGranted('jo_in.list', null, 'No access.'); - $params = $this->initParameters('jo_in'); $params['mode'] = 'create_vehicle'; $params['submit_url'] = $this->generateUrl('jo_in_submit'); $params['return_url'] = $this->generateUrl('jo_in'); @@ -642,62 +649,68 @@ class JobOrderController extends BaseController ]; } + /** + * @Menu(selected="jo_proc") + */ public function listProcessing() { $this->denyAccessUnlessGranted('jo_proc.list', null, 'No access.'); - $params = $this->initParameters('jo_proc'); - $params['table_refresh_rate'] = $this->container->getParameter('job_order_refresh_interval'); return $this->render('job-order/list.processing.html.twig', $params); } - + + /** + * @Menu(selected="jo_assign") + */ public function listAssigning() { $this->denyAccessUnlessGranted('jo_assign.list', null, 'No access.'); - $params = $this->initParameters('jo_assign'); - $params['table_refresh_rate'] = $this->container->getParameter('job_order_refresh_interval'); return $this->render('job-order/list.assigning.html.twig', $params); } + /** + * @Menu(selected="jo_fulfill") + */ public function listFulfillment() { $this->denyAccessUnlessGranted('jo_fulfill.list', null, 'No access.'); - $params = $this->initParameters('jo_fulfill'); - $params['table_refresh_rate'] = $this->container->getParameter('job_order_refresh_interval'); return $this->render('job-order/list.fulfillment.html.twig', $params); } + /** + * @Menu(selected="jo_open") + */ public function listOpen() { $this->denyAccessUnlessGranted('jo_open.list', null, 'No access.'); - $params = $this->initParameters('jo_open'); - $params['table_refresh_rate'] = $this->container->getParameter('job_order_refresh_interval'); $params['statuses'] = JOStatus::getCollection(); return $this->render('job-order/list.open.html.twig', $params); } + /** + * @Menu(selected="jo_all") + */ public function listAll() { $this->denyAccessUnlessGranted('jo_all.list', null, 'No access.'); - $params = $this->initParameters('jo_all'); - $params['table_refresh_rate'] = $this->container->getParameter('job_order_refresh_interval'); return $this->render('job-order/list.all.html.twig', $params); } + /* public function listRows($tier) { // check which job order tier is being called for and confirm access @@ -712,6 +725,7 @@ class JobOrderController extends BaseController // response return $this->render('job-order/list.html.twig', $params); } + */ public function getRows(Request $req, $tier) { @@ -841,6 +855,9 @@ class JobOrderController extends BaseController ]); } + /** + * @Menu(selected="jo_proc") + */ public function processingForm(MapTools $map_tools, $id) { $this->denyAccessUnlessGranted('jo_proc.list', null, 'No access.'); @@ -894,7 +911,6 @@ class JobOrderController extends BaseController // NOTE: we are able to lock, everything should be fine now - $params = $this->initParameters('jo_proc'); $params['mode'] = 'update-processing'; $params['status_cancelled'] = JOStatus::CANCELLED; @@ -1102,6 +1118,9 @@ class JobOrderController extends BaseController ]); } + /** + * @Menu(selected="jo_assign") + */ public function assigningForm(MapTools $map_tools, $id) { $this->denyAccessUnlessGranted('jo_assign.list', null, 'No access.'); @@ -1111,7 +1130,6 @@ class JobOrderController extends BaseController // manual transaction since we're locking $em->getConnection()->beginTransaction(); - $params = $this->initParameters('jo_assign'); $params['mode'] = 'update-assigning'; try @@ -1288,13 +1306,15 @@ class JobOrderController extends BaseController ]); } + /** + * @Menu(selected="jo_fulfill") + */ public function fulfillmentForm(MapTools $map_tools, $id) { $this->denyAccessUnlessGranted('jo_fulfill.list', null, 'No access.'); $em = $this->getDoctrine()->getManager(); - $params = $this->initParameters('jo_fulfill'); $params['mode'] = 'update-fulfillment'; // get row data @@ -1505,13 +1525,15 @@ class JobOrderController extends BaseController $client->disconnect(); } + /** + * @Menu(selected="jo_open") + */ public function openHubForm(MapTools $map_tools, $id) { $this->denyAccessUnlessGranted('jo_open.list', null, 'No access.'); $em = $this->getDoctrine()->getManager(); - $params = $this->initParameters('jo_open'); $params['mode'] = 'update-reassign-hub'; // get row data @@ -1693,13 +1715,15 @@ class JobOrderController extends BaseController ]); } + /** + * @Menu(selected="jo_open") + */ public function openRiderForm($id) { $this->denyAccessUnlessGranted('jo_open.list', null, 'No access.'); $em = $this->getDoctrine()->getManager(); - $params = $this->initParameters('jo_open'); $params['mode'] = 'update-reassign-rider'; // get row data @@ -1835,13 +1859,15 @@ class JobOrderController extends BaseController ]); } + /** + * @Menu(selected="jo_all") + */ public function allForm($id) { $this->denyAccessUnlessGranted('jo_all.list', null, 'No access.'); $em = $this->getDoctrine()->getManager(); - $params = $this->initParameters('jo_all'); $params['mode'] = 'update-all'; // get row data From 5a0bf45983524f6a645b56dddca652ae175a6e41 Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Fri, 7 Jun 2019 09:19:06 +0000 Subject: [PATCH 09/13] Add annotations to controllers for outlet, promo, report, rider, search, and test. #222 --- src/Controller/OutletController.php | 26 ++++++++++++---------- src/Controller/PromoController.php | 27 +++++++++++++---------- src/Controller/ReportController.php | 31 +++++++++++++------------- src/Controller/RiderController.php | 23 +++++++++++-------- src/Controller/SearchController.php | 24 ++++++++++---------- src/Controller/TestController.php | 34 +++++++++++++++++------------ 6 files changed, 93 insertions(+), 72 deletions(-) diff --git a/src/Controller/OutletController.php b/src/Controller/OutletController.php index 7b1c4f8d..941353ca 100644 --- a/src/Controller/OutletController.php +++ b/src/Controller/OutletController.php @@ -2,7 +2,6 @@ namespace App\Controller; -use App\Ramcar\BaseController; use App\Entity\Outlet; use App\Entity\Hub; @@ -12,19 +11,23 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface; use Symfony\Component\Validator\Validator\ValidatorInterface; +use Symfony\Bundle\FrameworkBundle\Controller\Controller; + +use Catalyst\MenuBundle\Annotation\Menu; use CrEOF\Spatial\PHP\Types\Geometry\Point; use DateTime; -class OutletController extends BaseController +class OutletController extends Controller { + /** + * @Menu(selected="outlet_list") + */ public function index() { $this->denyAccessUnlessGranted('outlet.list', null, 'No access.'); - $params = $this->initParameters('outlet_list'); - - return $this->render('outlet/list.html.twig', $params); + return $this->render('outlet/list.html.twig'); } public function rows(Request $req) @@ -126,11 +129,13 @@ class OutletController extends BaseController ]); } + /** + * @Menu(selected="outlet_list") + */ public function addForm() { $this->denyAccessUnlessGranted('outlet.add', null, 'No access.'); - $params = $this->initParameters('outlet_list'); $params['obj'] = new Outlet(); $params['mode'] = 'create'; @@ -241,12 +246,13 @@ class OutletController extends BaseController ]); } + /** + * @Menu(selected="outlet_list") + */ public function updateForm($id) { $this->denyAccessUnlessGranted('outlet.update', null, 'No access.'); - $params = $this->initParameters('outlet_list'); - // get row data $em = $this->getDoctrine()->getManager(); $obj = $em->getRepository(Outlet::class)->find($id); @@ -329,9 +335,7 @@ class OutletController extends BaseController { $this->denyAccessUnlessGranted('outlet.delete', null, 'No access.'); - $params = $this->initParameters('outlet_list'); - - // get objext data + // get object data $em = $this->getDoctrine()->getManager(); $obj = $em->getRepository(Outlet::class)->find($id); diff --git a/src/Controller/PromoController.php b/src/Controller/PromoController.php index f747ceb9..bc34a4c9 100644 --- a/src/Controller/PromoController.php +++ b/src/Controller/PromoController.php @@ -2,7 +2,6 @@ namespace App\Controller; -use App\Ramcar\BaseController; use App\Ramcar\DiscountApply; use App\Entity\Promo; @@ -11,17 +10,22 @@ use Doctrine\ORM\QueryBuilder; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Validator\Validator\ValidatorInterface; +use Symfony\Bundle\FrameworkBundle\Controller\Controller; + +use Catalyst\MenuBundle\Annotation\Menu; + use DateTime; -class PromoController extends BaseController +class PromoController extends Controller { + /** + * @Menu(selected="promo_list") + */ public function index() { $this->denyAccessUnlessGranted('promo.list', null, 'No access.'); - $params = $this->initParameters('promo_list'); - - return $this->render('promo/list.html.twig', $params); + return $this->render('promo/list.html.twig'); } public function rows(Request $req) @@ -130,11 +134,13 @@ class PromoController extends BaseController } } + /** + * @Menu(selected="promo_list") + */ public function addForm() { $this->denyAccessUnlessGranted('promo.add', null, 'No access.'); - $params = $this->initParameters('promo_list'); $params['obj'] = new Promo(); $params['mode'] = 'create'; $params['discount_apply'] = DiscountApply::getCollection(); @@ -183,12 +189,13 @@ class PromoController extends BaseController ]); } + /** + * @Menu(selected="promo_list") + */ public function updateForm($id) { $this->denyAccessUnlessGranted('promo.update', null, 'No access.'); - $params = $this->initParameters('promo_list'); - // get row data $em = $this->getDoctrine()->getManager(); $obj = $em->getRepository(Promo::class)->find($id); @@ -252,9 +259,7 @@ class PromoController extends BaseController { $this->denyAccessUnlessGranted('promo.delete', null, 'No access.'); - $params = $this->initParameters('promo_list'); - - // get objext data + // get object data $em = $this->getDoctrine()->getManager(); $obj = $em->getRepository(Promo::class)->find($id); diff --git a/src/Controller/ReportController.php b/src/Controller/ReportController.php index 800474d7..b12c1a34 100644 --- a/src/Controller/ReportController.php +++ b/src/Controller/ReportController.php @@ -2,7 +2,6 @@ namespace App\Controller; -use App\Ramcar\BaseController; use App\Ramcar\JORejectionReason; use App\Ramcar\ServiceType; use App\Ramcar\JOStatus; @@ -18,19 +17,23 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\StreamedResponse; use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface; use Symfony\Component\Validator\Validator\ValidatorInterface; +use Symfony\Bundle\FrameworkBundle\Controller\Controller; + +use Catalyst\MenuBundle\Annotation\Menu; use CrEOF\Spatial\PHP\Types\Geometry\Point; use DateTime; -class ReportController extends BaseController +class ReportController extends Controller { + /** + * @Menu(selected="outlet_list") + */ public function rejectSummaryForm() { $this->denyAccessUnlessGranted('report.reject', null, 'No access.'); - $params = $this->initParameters('outlet_list'); - - return $this->render('report/rejection/summary_form.html.twig', $params); + return $this->render('report/rejection/summary_form.html.twig'); } public function rejectSummarySubmit(Request $req) @@ -152,13 +155,14 @@ class ReportController extends BaseController */ } + /** + * @Menu(selected="outlet_list") + */ public function rejectDetailForm() { $this->denyAccessUnlessGranted('report.reject', null, 'No access.'); - $params = $this->initParameters('outlet_list'); - - return $this->render('report/rejection/detail_form.html.twig', $params); + return $this->render('report/rejection/detail_form.html.twig'); } public function rejectDetailSubmit(Request $req) @@ -264,13 +268,14 @@ class ReportController extends BaseController */ } + /** + * @Menu(selected="outlet_list") + */ public function batteryConflictForm() { $this->denyAccessUnlessGranted('report.battery.conflict', null, 'No access.'); - $params = $this->initParameters('outlet_list'); - - return $this->render('report/battery/batt_conflict_form.html.twig', $params); + return $this->render('report/battery/batt_conflict_form.html.twig'); } public function batteryConflictSubmit(Request $req) @@ -393,9 +398,5 @@ class ReportController extends BaseController $resp->headers->set('Content-Disposition', 'attachment; filename="' . $filename . '"'); return $resp; - - //return $this->json([ - // 'result' => $results, - //]); } } diff --git a/src/Controller/RiderController.php b/src/Controller/RiderController.php index 16b9bb8c..a62eebd1 100644 --- a/src/Controller/RiderController.php +++ b/src/Controller/RiderController.php @@ -2,7 +2,6 @@ namespace App\Controller; -use App\Ramcar\BaseController; use App\Ramcar\DayOfWeek; use App\Entity\Rider; use App\Entity\RiderSchedule; @@ -16,18 +15,22 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface; use Symfony\Component\Validator\Validator\ValidatorInterface; use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface; +use Symfony\Bundle\FrameworkBundle\Controller\Controller; + +use Catalyst\MenuBundle\Annotation\Menu; use DateTime; -class RiderController extends BaseController +class RiderController extends Controller { + /** + * @Menu(selected="rider_list") + */ public function index() { $this->denyAccessUnlessGranted('rider.list', null, 'No access.'); - $params = $this->initParameters('rider_list'); - - return $this->render('rider/list.html.twig', $params); + return $this->render('rider/list.html.twig'); } public function rows(Request $req) @@ -131,11 +134,13 @@ class RiderController extends BaseController ]); } + /** + * @Menu(selected="rider_list") + */ public function addForm() { $this->denyAccessUnlessGranted('rider.add', null, 'No access.'); - $params = $this->initParameters('rider_list'); $params['obj'] = new Rider(); $params['mode'] = 'create'; @@ -279,11 +284,13 @@ class RiderController extends BaseController } } + /** + * @Menu(selected="rider_list") + */ public function updateForm($id) { $this->denyAccessUnlessGranted('rider.update', null, 'No access.'); - $params = $this->initParameters('rider_list'); $params['mode'] = 'update'; // get row data @@ -450,8 +457,6 @@ class RiderController extends BaseController { $this->denyAccessUnlessGranted('rider.delete', null, 'No access.'); - $params = $this->initParameters('rider_list'); - // get row data $em = $this->getDoctrine()->getManager(); $row = $em->getRepository(Rider::class)->find($id); diff --git a/src/Controller/SearchController.php b/src/Controller/SearchController.php index 38e2fc42..bd5ac45a 100644 --- a/src/Controller/SearchController.php +++ b/src/Controller/SearchController.php @@ -2,8 +2,6 @@ namespace App\Controller; -use App\Ramcar\BaseController; - use App\Service\GeneralSearch; use App\Entity\LegacyJobOrder; @@ -11,30 +9,30 @@ use App\Entity\LegacyJobOrderRow; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Bundle\FrameworkBundle\Controller\Controller; -use App\Menu\Generator as MenuGenerator; +use Catalyst\MenuBundle\Annotation\Menu; -class SearchController extends BaseController +class SearchController extends Controller { - public function __construct(MenuGenerator $menu_gen) - { - parent::__construct($menu_gen); - } - + /** + * @Menu(selected="general_search") + */ public function index() { $this->denyaccessUnlessGranted('general.search', null, 'No access.'); - $params = $this->initParameters('general_search'); $params["mode"] = "form"; // response return $this->render('search/form.html.twig', $params); } + /** + * @Menu(selected="general_search") + */ public function search(Request $req, GeneralSearch $search) { $this->denyAccessUnlessGranted('general.search', null, 'No access.'); - $params = $this->initParameters('general_search'); $search_term = $req->query->get('search'); $results = $search->search($search_term); @@ -47,6 +45,9 @@ class SearchController extends BaseController return $this->render('search/form.html.twig', $params); } + /** + * @Menu(selected="general_search") + */ public function legacyJODetails($id) { $this->denyAccessUnlessGranted('general.search', null, 'No access.'); @@ -55,7 +56,6 @@ class SearchController extends BaseController $em = $this->getDoctrine()->getManager(); $legacy_jo = $em->getRepository(LegacyJobOrder::class)->find($id); - $params = $this->initParameters('general.search'); $params['data'] = $legacy_jo; $params['mode'] = "details"; diff --git a/src/Controller/TestController.php b/src/Controller/TestController.php index 53006ccf..4957cab0 100644 --- a/src/Controller/TestController.php +++ b/src/Controller/TestController.php @@ -2,7 +2,6 @@ namespace App\Controller; -use App\Ramcar\BaseController; use Catalyst\AuthBundle\Service\ACLGenerator; use CrEOF\Spatial\PHP\Types\Geometry\Point; @@ -11,39 +10,46 @@ use App\Entity\Outlet; use GuzzleHttp\Client as GuzzleClient; use App\Service\MapTools; use Doctrine\Common\Util\Debug; +use Symfony\Bundle\FrameworkBundle\Controller\Controller; -class TestController extends BaseController +use Catalyst\MenuBundle\Annotation\Menu; + +class TestController extends Controller { + /** + * @Menu(selected="home") + */ public function index(ACLGenerator $acl_gen) { - $params = $this->initParameters('home'); - $acl_data = $acl_gen->getACL(); error_log(print_r($acl_data, true)); - return $this->render('home.html.twig', $params); + return $this->render('home.html.twig'); } + /** + * @Menu(selected="home") + */ public function testIsGranted() { - $params = $this->initParameters('home'); - error_log(print_r($this->isGranted('dashboard.menu'), true)); - return $this->render('home.html.twig', $params); + return $this->render('home.html.twig'); } + /** + * @Menu(selected="home") + */ public function gmap() { - $params = $this->initParameters('home'); - - return $this->render('test/map.html.twig', $params); + return $this->render('test/map.html.twig'); } + /** + * @Menu(selected="home") + */ public function distance(MapTools $map_tools) { - $params = $this->initParameters('home'); - $point = new Point(121.0495453, 14.6042567); // $point = new Point(120.343692, 16.048560); @@ -55,6 +61,6 @@ class TestController extends BaseController error_log($data['duration']); } - return $this->render('home.html.twig', $params); + return $this->render('home.html.twig'); } } From 4ccdb8c5aab122dffdf82057b406fd318b33be3f Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Fri, 7 Jun 2019 09:49:28 +0000 Subject: [PATCH 10/13] Add menu annotations to controllers for ticket, user, vehicle, and vehicle manufacturer. Remove BaseController from APIUserController. #222 --- src/Controller/APIUserController.php | 2 -- src/Controller/TicketController.php | 23 +++++++++------ src/Controller/UserController.php | 27 +++++++++++------- src/Controller/VehicleController.php | 23 +++++++++------ .../VehicleManufacturerController.php | 28 +++++++++---------- 5 files changed, 58 insertions(+), 45 deletions(-) diff --git a/src/Controller/APIUserController.php b/src/Controller/APIUserController.php index 077f4064..8dd7e2f1 100644 --- a/src/Controller/APIUserController.php +++ b/src/Controller/APIUserController.php @@ -2,8 +2,6 @@ namespace App\Controller; -use App\Ramcar\BaseController; - use Catalyst\APIBundle\Entity\User as APIUser; use Catalyst\APIBundle\Entity\Role as APIRole; diff --git a/src/Controller/TicketController.php b/src/Controller/TicketController.php index cdac40e0..c79aedd2 100644 --- a/src/Controller/TicketController.php +++ b/src/Controller/TicketController.php @@ -2,7 +2,6 @@ namespace App\Controller; -use App\Ramcar\BaseController; use App\Ramcar\TicketType; use App\Ramcar\TicketStatus; use App\Entity\Ticket; @@ -14,18 +13,22 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Validator\Validator\ValidatorInterface; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; +use Symfony\Bundle\FrameworkBundle\Controller\Controller; + +use Catalyst\MenuBundle\Annotation\Menu; use DateTime; -class TicketController extends BaseController +class TicketController extends Controller { + /** + * @Menu(selected="ticket_list") + */ public function index() { $this->denyAccessUnlessGranted('ticket.list', null, 'No access.'); - $params = $this->initParameters('ticket_list'); - - return $this->render('ticket/list.html.twig', $params); + return $this->render('ticket/list.html.twig'); } public function rows(Request $req) @@ -120,11 +123,13 @@ class TicketController extends BaseController ]); } + /** + * @Menu(selected="ticket_list") + */ public function addForm(Request $req, $customer_id, $job_order_id) { $this->denyAccessUnlessGranted('ticket.add', null, 'No access.'); - $params = $this->initParameters('ticket_list'); $params['obj'] = new Ticket(); $params['mode'] = 'create'; $params['customer'] = false; @@ -292,11 +297,13 @@ class TicketController extends BaseController } } + /** + * @Menu(selected="ticket_list") + */ public function updateForm(Request $req, $id) { $this->denyAccessUnlessGranted('ticket.update', null, 'No access.'); - $params = $this->initParameters('ticket_list'); $params['mode'] = 'update'; // get row data @@ -440,8 +447,6 @@ class TicketController extends BaseController { $this->denyAccessUnlessGranted('ticket.delete', null, 'No access.'); - $params = $this->initParameters('ticket_list'); - // get row data $em = $this->getDoctrine()->getManager(); $obj = $em->getRepository(Ticket::class)->find($id); diff --git a/src/Controller/UserController.php b/src/Controller/UserController.php index 7875c655..d9488e81 100644 --- a/src/Controller/UserController.php +++ b/src/Controller/UserController.php @@ -2,7 +2,6 @@ namespace App\Controller; -use App\Ramcar\BaseController; use App\Entity\User; use App\Entity\Role; use App\Entity\Hub; @@ -12,16 +11,20 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface; use Symfony\Component\Validator\Validator\ValidatorInterface; +use Symfony\Bundle\FrameworkBundle\Controller\Controller; -class UserController extends BaseController +use Catalyst\MenuBundle\Annotation\Menu; + +class UserController extends Controller { + /** + * @Menu(selected="user_list") + */ public function index() { $this->denyAccessUnlessGranted('user.list', null, 'No access.'); - $params = $this->initParameters('user_list'); - - return $this->render('user/list.html.twig', $params); + return $this->render('user/list.html.twig'); } public function rows(Request $req) @@ -123,11 +126,13 @@ class UserController extends BaseController ]); } + /** + * @Menu(selected="user_list") + */ public function addForm() { $this->denyAccessUnlessGranted('user.add', null, 'No access.'); - $params = $this->initParameters('user_list'); $params['obj'] = new User(); $params['mode'] = 'create'; @@ -237,11 +242,13 @@ class UserController extends BaseController } } + /** + * @Menu(selected="user_list") + */ public function updateForm($id) { $this->denyAccessUnlessGranted('user.update', null, 'No access.'); - $params = $this->initParameters('user_list'); $params['mode'] = 'update'; // get row data @@ -361,8 +368,6 @@ class UserController extends BaseController { $this->denyAccessUnlessGranted('user.delete', null, 'No access.'); - $params = $this->initParameters('user_list'); - // get row data $em = $this->getDoctrine()->getManager(); $obj = $em->getRepository(User::class)->find($id); @@ -392,11 +397,13 @@ class UserController extends BaseController } } + /** + * @Menu(selected="user_profile") + */ public function profileForm() { $this->denyAccessUnlessGranted('user.profile', null, 'No access.'); - $params = $this->initParameters('user_profile'); $params['mode'] = 'profile'; // get row data diff --git a/src/Controller/VehicleController.php b/src/Controller/VehicleController.php index 2065f1f9..db82b18b 100644 --- a/src/Controller/VehicleController.php +++ b/src/Controller/VehicleController.php @@ -2,7 +2,6 @@ namespace App\Controller; -use App\Ramcar\BaseController; use App\Entity\Vehicle; use App\Entity\VehicleManufacturer; use App\Entity\Battery; @@ -11,17 +10,21 @@ use Doctrine\ORM\Query; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Validator\Validator\ValidatorInterface; +use Symfony\Bundle\FrameworkBundle\Controller\Controller; -class VehicleController extends BaseController +use Catalyst\MenuBundle\Annotation\Menu; + +class VehicleController extends Controller { + /** + * @Menu(selected="vehicle_list") + */ public function index() { $this->denyAccessUnlessGranted('vehicle.list', null, 'No access.'); - $params = $this->initParameters('vehicle_list'); - // response - return $this->render('vehicle/list.html.twig', $params); + return $this->render('vehicle/list.html.twig'); } public function rows(Request $req) @@ -121,11 +124,13 @@ class VehicleController extends BaseController ]); } + /** + * @Menu(selected="vehicle_list") + */ public function addForm() { $this->denyAccessUnlessGranted('vehicle.add', null, 'No access.'); - $params = $this->initParameters('vehicle_list'); $params['obj'] = new Vehicle(); $params['mode'] = 'create'; @@ -197,11 +202,13 @@ class VehicleController extends BaseController } } + /** + * @Menu(selected="vehicle_list") + */ public function updateForm($id) { $this->denyAccessUnlessGranted('vehicle.update', null, 'No access.'); - $params = $this->initParameters('vehicle_list'); $params['mode'] = 'update'; // get row data @@ -287,8 +294,6 @@ class VehicleController extends BaseController { $this->denyAccessUnlessGranted('vehicle.delete', null, 'No access.'); - $params = $this->initParameters('vehicle_list'); - // get row data $em = $this->getDoctrine()->getManager(); $row = $em->getRepository(Vehicle::class)->find($id); diff --git a/src/Controller/VehicleManufacturerController.php b/src/Controller/VehicleManufacturerController.php index db1a402c..b2abd9e8 100644 --- a/src/Controller/VehicleManufacturerController.php +++ b/src/Controller/VehicleManufacturerController.php @@ -2,31 +2,27 @@ namespace App\Controller; -use App\Ramcar\BaseController; use App\Entity\VehicleManufacturer; use Doctrine\ORM\Query; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Validator\Validator\ValidatorInterface; +use Symfony\Bundle\FrameworkBundle\Controller\Controller; -use App\Menu\Generator as MenuGenerator; +use Catalyst\MenuBundle\Annotation\Menu; -class VehicleManufacturerController extends BaseController +class VehicleManufacturerController extends Controller { - public function __construct(MenuGenerator $menu_gen) - { - parent::__construct($menu_gen); - } - + /** + * @Menu(selected="vmfg_list") + */ public function index() { $this->denyAccessUnlessGranted('vmfg.list', null, 'No access.'); - $params = $this->initParameters('vmfg_list'); - // response - return $this->render('vehicle-manufacturer/list.html.twig', $params); + return $this->render('vehicle-manufacturer/list.html.twig'); } public function rows(Request $req) @@ -115,11 +111,13 @@ class VehicleManufacturerController extends BaseController ]); } + /** + * @Menu(selected="vmfg_list") + */ public function addForm() { $this->denyAccessUnlessGranted('vmfg.add', null, 'No access.'); - $params = $this->initParameters('vmfg_list'); $params['obj'] = new VehicleManufacturer(); $params['mode'] = 'create'; @@ -173,11 +171,13 @@ class VehicleManufacturerController extends BaseController } } + /** + * @Menu(selected="vmfg_list") + */ public function updateForm($id) { $this->denyAccessUnlessGranted('vmfg.update', null, 'No access.'); - $params = $this->initParameters('vmfg_list'); $params['mode'] = 'update'; // get row data @@ -248,8 +248,6 @@ class VehicleManufacturerController extends BaseController { $this->denyAccessUnlessGranted('vmfg.delete', null, 'No access.'); - $params = $this->initParameters('vmfg_list'); - // get row data $em = $this->getDoctrine()->getManager(); $row = $em->getRepository(VehicleManufacturer::class)->find($id); From b6f7d70e1393ada451687eb2a947cd3836121280 Mon Sep 17 00:00:00 2001 From: Kendrick Chan Date: Sat, 8 Jun 2019 14:52:01 +0800 Subject: [PATCH 11/13] Add annotations to APIRole and Role controllers #222 --- src/Controller/APIRoleController.php | 35 +++++++++++++++++----------- src/Controller/RoleController.php | 35 +++++++++++++++++----------- 2 files changed, 44 insertions(+), 26 deletions(-) diff --git a/src/Controller/APIRoleController.php b/src/Controller/APIRoleController.php index a00d4ba2..d2dbd888 100644 --- a/src/Controller/APIRoleController.php +++ b/src/Controller/APIRoleController.php @@ -2,37 +2,37 @@ namespace App\Controller; -use App\Ramcar\BaseController; - use Catalyst\APIBundle\Entity\Role as APIRole; use Catalyst\APIBundle\Access\Generator as APIACLGenerator; -use Doctrine\ORM\Query; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Validator\Validator\ValidatorInterface; +use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Doctrine\ORM\Query; use Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException; -use App\Menu\Generator as MenuGenerator; +use Catalyst\MenuBundle\Annotation\Menu; -class APIRoleController extends BaseController + +class APIRoleController extends Controller { protected $api_acl_gen; - public function __construct(MenuGenerator $menu_gen, APIACLGenerator $api_acl_gen) + public function __construct(APIACLGenerator $api_acl_gen) { $this->api_acl_gen = $api_acl_gen; - parent::__construct($menu_gen); } + /** + * @Menu(selected="api_role_list") + */ public function index() { $this->denyAccessUnlessGranted('apirole.list', null, 'No access.'); - $params = $this->initParameters('api_role_list'); - // response - return $this->render('api-role/list.html.twig', $params); + return $this->render('api-role/list.html.twig'); } public function rows(Request $req) @@ -128,11 +128,14 @@ class APIRoleController extends BaseController ]); } + /** + * @Menu(selected="api_role_list") + */ public function addForm() { $this->denyAccessUnlessGranted('apirole.add', null, 'No access.'); - $params = $this->initParameters('apirole_list'); + $params = []; $this->padAPIACLHierarchy($params); $params['obj'] = new APIRole(); $params['mode'] = 'create'; @@ -194,11 +197,14 @@ class APIRoleController extends BaseController } } + /** + * @Menu(selected="api_role_list") + */ public function updateForm($id) { $this->denyAccessUnlessGranted('apirole.update', null, 'No access.'); - $params = $this->initParameters('api_role_list'); + $params = []; $this->padAPIACLHierarchy($params); $params['mode'] = 'update'; @@ -291,11 +297,14 @@ class APIRoleController extends BaseController } } + /** + * @Menu(selected="api_role_list") + */ public function destroy($id) { $this->denyAccessUnlessGranted('apirole.delete', null, 'No access.'); - $params = $this->initParameters('apirole_list'); + $params = []; // get row data $em = $this->getDoctrine()->getManager(); diff --git a/src/Controller/RoleController.php b/src/Controller/RoleController.php index f8299cbc..754ab40c 100644 --- a/src/Controller/RoleController.php +++ b/src/Controller/RoleController.php @@ -2,36 +2,36 @@ namespace App\Controller; -use App\Ramcar\BaseController; use App\Entity\Role; -use Doctrine\ORM\Query; -use Symfony\Component\HttpFoundation\Request; +use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Validator\Validator\ValidatorInterface; +use Symfony\Component\HttpFoundation\Request; +use Doctrine\ORM\Query; use Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException; -use App\Menu\Generator as MenuGenerator; use Catalyst\AuthBundle\Service\ACLGenerator; +use Catalyst\MenuBundle\Annotation\Menu; -class RoleController extends BaseController +class RoleController extends Controller { protected $acl_gen; - public function __construct(MenuGenerator $menu_gen, ACLGenerator $acl_gen) + public function __construct(ACLGenerator $acl_gen) { $this->acl_gen = $acl_gen; - parent::__construct($menu_gen); } + /** + * @Menu(selected="role_list") + */ public function index() { $this->denyAccessUnlessGranted('role.list', null, 'No access.'); - $params = $this->initParameters('role_list'); - // response - return $this->render('role/list.html.twig', $params); + return $this->render('role/list.html.twig'); } public function rows(Request $req) @@ -134,11 +134,14 @@ class RoleController extends BaseController $params['acl_hierarchy'] = $acl_data['hierarchy']; } + /** + * @Menu(selected="role_list") + */ public function addForm() { $this->denyAccessUnlessGranted('role.add', null, 'No access.'); - $params = $this->initParameters('role_list'); + $params = []; $this->padACLHierarchy($params); $params['obj'] = new Role(); $params['mode'] = 'create'; @@ -200,11 +203,14 @@ class RoleController extends BaseController } } + /** + * @Menu(selected="role_list") + */ public function updateForm($id) { $this->denyAccessUnlessGranted('role.update', null, 'No access.'); - $params = $this->initParameters('role_list'); + $params = []; $this->padACLHierarchy($params); $params['mode'] = 'update'; @@ -297,11 +303,14 @@ class RoleController extends BaseController } } + /** + * @Menu(selected="role_list") + */ public function destroy($id) { $this->denyAccessUnlessGranted('role.delete', null, 'No access.'); - $params = $this->initParameters('role_list'); + $params = []; // get row data $em = $this->getDoctrine()->getManager(); From 7d59006e90acf31145129bd7a694737eb8cd4a9a Mon Sep 17 00:00:00 2001 From: Kendrick Chan Date: Sat, 8 Jun 2019 14:54:08 +0800 Subject: [PATCH 12/13] Remove BaseController since it's only needed for menu #222 --- src/Ramcar/BaseController.php | 31 ------------------------------- 1 file changed, 31 deletions(-) delete mode 100644 src/Ramcar/BaseController.php diff --git a/src/Ramcar/BaseController.php b/src/Ramcar/BaseController.php deleted file mode 100644 index 48d78bbf..00000000 --- a/src/Ramcar/BaseController.php +++ /dev/null @@ -1,31 +0,0 @@ -menu_gen = $menu_gen; - } - - protected function initParameters($route) - { - // get menu - $menu = $this->menu_gen->getMenu('main_menu'); - - // set menu selected - $sel = $menu['index']->get($route); - if ($sel != null) - $sel->setSelected(); - - return [ - 'main_menu' => $menu - ]; - } -} From fa069218b2bd67c340afa291e90a80c70a303358 Mon Sep 17 00:00:00 2001 From: Kendrick Chan Date: Sat, 8 Jun 2019 15:23:24 +0800 Subject: [PATCH 13/13] Remove in-project menu bundle and use composer #222 --- catalyst/menu-bundle/Annotation/Menu.php | 13 - catalyst/menu-bundle/CatalystMenuBundle.php | 10 - .../Listener/MenuAnnotationListener.php | 76 ---- catalyst/menu-bundle/Menu/Collection.php | 71 ---- catalyst/menu-bundle/Menu/Generator.php | 164 -------- catalyst/menu-bundle/Menu/Item.php | 138 ------- composer.json | 5 +- composer.lock | 353 ++++++++++-------- symfony.lock | 3 + 9 files changed, 202 insertions(+), 631 deletions(-) delete mode 100644 catalyst/menu-bundle/Annotation/Menu.php delete mode 100644 catalyst/menu-bundle/CatalystMenuBundle.php delete mode 100644 catalyst/menu-bundle/Listener/MenuAnnotationListener.php delete mode 100644 catalyst/menu-bundle/Menu/Collection.php delete mode 100644 catalyst/menu-bundle/Menu/Generator.php delete mode 100644 catalyst/menu-bundle/Menu/Item.php diff --git a/catalyst/menu-bundle/Annotation/Menu.php b/catalyst/menu-bundle/Annotation/Menu.php deleted file mode 100644 index e8001aeb..00000000 --- a/catalyst/menu-bundle/Annotation/Menu.php +++ /dev/null @@ -1,13 +0,0 @@ -annot_reader = $annot_reader; - $this->menu_gen = $menu_gen; - $this->twig = $twig; - $this->menu_name = $menu_name; - } - - public function onKernelController(FilterControllerEvent $event) - { - if (!$event->isMasterRequest()) - return; - - // get controller - $event_controller = $event->getController(); - if (!is_array($event_controller)) - return; - - list($controller, $method_name) = $event_controller; - - // get reflection class - try - { - $ref_controller = new ReflectionClass($controller); - } - catch (ReflectionException $e) - { - throw new RuntimeException('Cannot read menu annotation.'); - } - - // get method annotations - $ref_method = $ref_controller->getMethod($method_name); - $annotation = $this->annot_reader->getMethodAnnotation($ref_method, MenuAnnotation::class); - - // check if we get anything - if ($annotation == null) - return; - - $this->selectMenu($annotation->selected); - } - - protected function selectMenu($selected) - { - // get menu - $menu = $this->menu_gen->getMenu($this->menu_name); - - // set menu selected - $sel = $menu['index']->get($selected); - if ($sel != null) - $sel->setSelected(); - - // create twig global variable - $this->twig->addGlobal($this->menu_name, $menu); - } -} diff --git a/catalyst/menu-bundle/Menu/Collection.php b/catalyst/menu-bundle/Menu/Collection.php deleted file mode 100644 index 2ddfc50d..00000000 --- a/catalyst/menu-bundle/Menu/Collection.php +++ /dev/null @@ -1,71 +0,0 @@ -position = 0; - $this->array = array(); - $this->index_array = array(); - } - - // iterator stuff - public function rewind() - { - $this->position = 0; - } - - public function current() - { - return $this->array[$this->index_array[$this->position]]; - } - - public function key() - { - return $this->position; - } - - public function next() - { - return ++$this->position; - } - - public function valid() - { - return isset($this->index_array[$this->position]); - } - // end of iterator stuff - - public function add(Item $mi) - { - $id = $mi->getID(); - $this->array[$id] = $mi; - $this->index_array[] = $id; - return $this; - } - - public function get($id) - { - if (isset($this->array[$id])) - return $this->array[$id]; - - return null; - } - - public function unselectAll() - { - foreach ($this->array as $mi) - $mi->setSelected(false, false); - - return $this; - } -} diff --git a/catalyst/menu-bundle/Menu/Generator.php b/catalyst/menu-bundle/Menu/Generator.php deleted file mode 100644 index eba63ab1..00000000 --- a/catalyst/menu-bundle/Menu/Generator.php +++ /dev/null @@ -1,164 +0,0 @@ -index = new Collection(); - $this->menu = new Collection(); - $this->router = $router; - $this->cache_dir = $cache_dir; - $this->config_dir = $config_dir; - $this->config_file = $config_file; - } - - public function getMenu($menu_key) - { - // initialize - $menu_data = [ - 'menu' => [], - 'index' => [] - ]; - - // cache config - $cache_file = $this->cache_dir . '/' . $this->config_file . '.' . $menu_key . '.serial'; - $menu_cache = new ConfigCache($cache_file, true); - - // cache not fresh - if (!$menu_cache->isFresh()) - { - $files = []; - $resources = []; - - try - { - // get location of menu config file - $path = $this->config_dir . '/' . $this->config_file; - $files[] = $path; - $resources[] = new FileResource($path); - - // TODO: handle routes changes as well - // NOTE: need to figure out how to handle route changes or require - // a cache clear for every route change - - // process bundle menu - $this->parseMenu($path, $menu_key); - } - catch (\InvalidArgumentException $e) - { - error_log($e->getMessage()); - error_log($menu_key . ' menu not found.'); - return $menu_data; - } - - $menu_data = [ - 'menu' => $this->menu, - 'index' => $this->index, - ]; - $menu_serial = serialize($menu_data); - $menu_cache->write($menu_serial, $resources); - } - else - { - $menu_serial = file_get_contents($cache_file); - $menu_data = unserialize($menu_serial); - $this->menu = $menu_data['menu']; - $this->index = $menu_data['index']; - } - - return $menu_data; - } - - protected function parseMenu($path, $menu_key) - { - $parser = new YamlParser(); - $menu_config = $parser->parse(file_get_contents($path)); - - // check if we have menu items - if (!isset($menu_config[$menu_key])) - { - error_log('No ' . $menu_key . ' found for ' . $path); - return; - } - - // go through each one - foreach ($menu_config[$menu_key] as $mi_data) - { - // check params - if (!isset($mi_data['icon'])) - $mi_data['icon'] = null; - - // instantiate - $mi = $this->newItem($mi_data['id'], $mi_data['label'], $mi_data['icon']); - - // acl - if (isset($mi_data['acl'])) - $mi->setACLKey($mi_data['acl']); - - // check parent - if (isset($mi_data['parent']) && $mi_data['parent'] != null) - { - $parent = $this->index->get($mi_data['parent']); - if ($parent == null) - continue; - - $parent->addChild($mi); - } - else - $this->menu->add($mi); - - } - } - - protected function newItem($id, $label, $icon = null) - { - $mi = new Item(); - $mi->setID($id) - ->setLabel($label); - - try - { - $mi->setLink($this->router->generate($id)); - } - catch (RouteNotFoundException $e) - { - // no route, set to # - $mi->setLink('#'); - } - - if ($icon != null) - $mi->setIcon($icon); - - $this->index->add($mi); - - return $mi; - } - - public function generate() - { - $this->getAllBundleMenus(); - - return $this->menu; - } - - public function getIndex() - { - return $this->index; - } -} diff --git a/catalyst/menu-bundle/Menu/Item.php b/catalyst/menu-bundle/Menu/Item.php deleted file mode 100644 index 14e178f0..00000000 --- a/catalyst/menu-bundle/Menu/Item.php +++ /dev/null @@ -1,138 +0,0 @@ -id = ''; - $this->icon = null; - $this->link = null; - $this->label = ''; - $this->children = []; - $this->selected = false; - $this->parent = null; - $this->acl_key = null; - } - - // setters - public function setID($id) - { - $this->id = $id; - return $this; - } - - public function setIcon($icon) - { - $this->icon = $icon; - return $this; - } - - public function setLink($link) - { - $this->link = $link; - return $this; - } - - public function setLabel($label) - { - $this->label = $label; - return $this; - } - - public function setParent(self $parent) - { - $this->parent = $parent; - return $this; - } - - public function addChild(self $child) - { - $child->setParent($this); - - // check if selected - if ($child->isSelected()) - $this->setSelected(); - - $this->children[] = $child; - return $this; - } - - public function setSelected($sel = true, $to_bubble = true) - { - if ($sel) - { - $this->selected = true; - // bubble up to parents - if ($this->parent != null && $to_bubble) - $this->parent->setSelected(true, true); - } - else - $this->selected = false; - return $this; - } - - public function setACLKey($key) - { - $this->acl_key = $key; - return $this; - } - - // getters - public function getID() - { - return $this->id; - } - - public function getIcon() - { - return $this->icon; - } - - public function getLink() - { - return $this->link; - } - - public function getLabel() - { - return $this->label; - } - - public function getChildren() - { - return $this->children; - } - - public function hasChildren() - { - if (count($this->children) > 0) - return true; - return false; - } - - public function isSelected() - { - return $this->selected; - } - - public function getParent() - { - return $this->parent; - } - - public function getACLKey() - { - return $this->acl_key; - } -} diff --git a/composer.json b/composer.json index db5bdbbf..f1871ad1 100644 --- a/composer.json +++ b/composer.json @@ -2,12 +2,14 @@ "type": "project", "license": "proprietary", "repositories": [ - { "type": "vcs", "url": "https://gitlab.com/jankstudio-catalyst/catalyst-auth.git" } + { "type": "vcs", "url": "git@gitlab.com:jankstudio-catalyst/auth-bundle.git" }, + { "type": "vcs", "url": "git@gitlab.com:jankstudio-catalyst/menu-bundle.git" } ], "require": { "php": "^7.1.3", "ext-iconv": "*", "catalyst/auth-bundle": "dev-master", + "catalyst/menu-bundle": "dev-master", "creof/doctrine2-spatial": "^1.2", "data-dog/audit-bundle": "^0.1.10", "guzzlehttp/guzzle": "^6.3", @@ -41,7 +43,6 @@ "autoload": { "psr-4": { "App\\": "src/", - "Catalyst\\MenuBundle\\": "catalyst/menu-bundle/", "Catalyst\\APIBundle\\": "catalyst/api-bundle/" } }, diff --git a/composer.lock b/composer.lock index 6f01470a..2e4fae65 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "b5e6f0fd50491b8275ea11d3668b26aa", + "content-hash": "60a481bcfc7c5465c831c26c20d2d7f6", "packages": [ { "name": "catalyst/auth-bundle", "version": "dev-master", "source": { "type": "git", - "url": "https://gitlab.com/jankstudio-catalyst/catalyst-auth.git", - "reference": "ee09abd3edd506f14dd073130c3ec2ad9047caae" + "url": "https://gitlab.com/jankstudio-catalyst/auth-bundle.git", + "reference": "156cf4d31aeb3de5e4f948b7dd608ac5545d1fc2" }, "dist": { "type": "zip", - "url": "https://gitlab.com/api/v4/projects/jankstudio-catalyst%2Fcatalyst-auth/repository/archive.zip?sha=ee09abd3edd506f14dd073130c3ec2ad9047caae", - "reference": "ee09abd3edd506f14dd073130c3ec2ad9047caae", + "url": "https://gitlab.com/api/v4/projects/jankstudio-catalyst%2Fauth-bundle/repository/archive.zip?sha=156cf4d31aeb3de5e4f948b7dd608ac5545d1fc2", + "reference": "156cf4d31aeb3de5e4f948b7dd608ac5545d1fc2", "shasum": "" }, "require": { @@ -41,7 +41,44 @@ "email": "kc@jankstudio.com" } ], - "time": "2019-06-05T15:46:15+00:00" + "time": "2019-06-05T16:44:31+00:00" + }, + { + "name": "catalyst/menu-bundle", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://gitlab.com/jankstudio-catalyst/menu-bundle.git", + "reference": "f2c9131b0e810f32d769febb7a39b01d4018a526" + }, + "dist": { + "type": "zip", + "url": "https://gitlab.com/api/v4/projects/jankstudio-catalyst%2Fmenu-bundle/repository/archive.zip?sha=f2c9131b0e810f32d769febb7a39b01d4018a526", + "reference": "f2c9131b0e810f32d769febb7a39b01d4018a526", + "shasum": "" + }, + "require": { + "doctrine/dbal": "^2.5.12", + "doctrine/doctrine-cache-bundle": "~1.2", + "php": "^7.0", + "symfony/framework-bundle": "~4.0" + }, + "type": "symfony-bundle", + "autoload": { + "psr-4": { + "Catalyst\\MenuBundle\\": "" + } + }, + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Kendrick Chan", + "email": "kc@jankstudio.com" + } + ], + "time": "2019-06-08T07:13:56+00:00" }, { "name": "creof/doctrine2-spatial", @@ -1202,20 +1239,20 @@ }, { "name": "doctrine/migrations", - "version": "v2.0.2", + "version": "v2.1.0", "source": { "type": "git", "url": "https://github.com/doctrine/migrations.git", - "reference": "43280c14b696a7896a9c70a5e0e4a312ff003187" + "reference": "ebe6f891a4c61574f77fc4a06d913d29236b8466" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/migrations/zipball/43280c14b696a7896a9c70a5e0e4a312ff003187", - "reference": "43280c14b696a7896a9c70a5e0e4a312ff003187", + "url": "https://api.github.com/repos/doctrine/migrations/zipball/ebe6f891a4c61574f77fc4a06d913d29236b8466", + "reference": "ebe6f891a4c61574f77fc4a06d913d29236b8466", "shasum": "" }, "require": { - "doctrine/dbal": "^2.6", + "doctrine/dbal": "^2.9", "ocramius/package-versions": "^1.3", "ocramius/proxy-manager": "^2.0.2", "php": "^7.1", @@ -1223,7 +1260,7 @@ "symfony/stopwatch": "^3.4||^4.0" }, "require-dev": { - "doctrine/coding-standard": "^5.0", + "doctrine/coding-standard": "^6.0", "doctrine/orm": "^2.6", "ext-pdo_sqlite": "*", "jdorn/sql-formatter": "^1.1", @@ -1246,7 +1283,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "2.1.x-dev" } }, "autoload": { @@ -1280,7 +1317,7 @@ "migrations", "php" ], - "time": "2019-04-25T22:14:55+00:00" + "time": "2019-06-06T15:47:41+00:00" }, { "name": "doctrine/orm", @@ -2321,16 +2358,16 @@ }, { "name": "symfony/cache", - "version": "v4.3.0", + "version": "v4.3.1", "source": { "type": "git", "url": "https://github.com/symfony/cache.git", - "reference": "f09463d1165396745fef0aae64b7a784c891be9f" + "reference": "2edc417da273bafee589a8758f0278416d04af38" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/cache/zipball/f09463d1165396745fef0aae64b7a784c891be9f", - "reference": "f09463d1165396745fef0aae64b7a784c891be9f", + "url": "https://api.github.com/repos/symfony/cache/zipball/2edc417da273bafee589a8758f0278416d04af38", + "reference": "2edc417da273bafee589a8758f0278416d04af38", "shasum": "" }, "require": { @@ -2395,7 +2432,7 @@ "caching", "psr6" ], - "time": "2019-05-27T08:16:38+00:00" + "time": "2019-06-06T10:05:02+00:00" }, { "name": "symfony/cache-contracts", @@ -2457,16 +2494,16 @@ }, { "name": "symfony/config", - "version": "v4.3.0", + "version": "v4.3.1", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "5455fc0ae8b46269b83a22949429ea878496408c" + "reference": "6379ee07398643e09e6ed1e87d9c62dfcad7f4eb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/5455fc0ae8b46269b83a22949429ea878496408c", - "reference": "5455fc0ae8b46269b83a22949429ea878496408c", + "url": "https://api.github.com/repos/symfony/config/zipball/6379ee07398643e09e6ed1e87d9c62dfcad7f4eb", + "reference": "6379ee07398643e09e6ed1e87d9c62dfcad7f4eb", "shasum": "" }, "require": { @@ -2517,20 +2554,20 @@ ], "description": "Symfony Config Component", "homepage": "https://symfony.com", - "time": "2019-05-20T16:16:12+00:00" + "time": "2019-05-30T16:10:05+00:00" }, { "name": "symfony/console", - "version": "v4.3.0", + "version": "v4.3.1", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "707b619d2c3bedf0224d56f95f77dabc60102305" + "reference": "d50bbeeb0e17e6dd4124ea391eff235e932cbf64" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/707b619d2c3bedf0224d56f95f77dabc60102305", - "reference": "707b619d2c3bedf0224d56f95f77dabc60102305", + "url": "https://api.github.com/repos/symfony/console/zipball/d50bbeeb0e17e6dd4124ea391eff235e932cbf64", + "reference": "d50bbeeb0e17e6dd4124ea391eff235e932cbf64", "shasum": "" }, "require": { @@ -2592,20 +2629,20 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2019-05-27T08:16:38+00:00" + "time": "2019-06-05T13:25:51+00:00" }, { "name": "symfony/debug", - "version": "v4.3.0", + "version": "v4.3.1", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "97cde06d798f1326857090bc1b7c8f9d225c3dcb" + "reference": "4e025104f1f9adb1f7a2d14fb102c9986d6e97c6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/97cde06d798f1326857090bc1b7c8f9d225c3dcb", - "reference": "97cde06d798f1326857090bc1b7c8f9d225c3dcb", + "url": "https://api.github.com/repos/symfony/debug/zipball/4e025104f1f9adb1f7a2d14fb102c9986d6e97c6", + "reference": "4e025104f1f9adb1f7a2d14fb102c9986d6e97c6", "shasum": "" }, "require": { @@ -2648,20 +2685,20 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2019-05-20T16:16:12+00:00" + "time": "2019-05-30T16:10:05+00:00" }, { "name": "symfony/dependency-injection", - "version": "v4.3.0", + "version": "v4.3.1", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "aa6fe799fa5adc938fc55aeccd2f5fb0aa0b8eac" + "reference": "fea7f73e278ee0337349a5a68b867fc656bb33f3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/aa6fe799fa5adc938fc55aeccd2f5fb0aa0b8eac", - "reference": "aa6fe799fa5adc938fc55aeccd2f5fb0aa0b8eac", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/fea7f73e278ee0337349a5a68b867fc656bb33f3", + "reference": "fea7f73e278ee0337349a5a68b867fc656bb33f3", "shasum": "" }, "require": { @@ -2721,20 +2758,20 @@ ], "description": "Symfony DependencyInjection Component", "homepage": "https://symfony.com", - "time": "2019-05-28T07:50:59+00:00" + "time": "2019-05-30T16:10:05+00:00" }, { "name": "symfony/doctrine-bridge", - "version": "v4.3.0", + "version": "v4.3.1", "source": { "type": "git", "url": "https://github.com/symfony/doctrine-bridge.git", - "reference": "5803336d65b4c7de8185d8947e843810ec61012d" + "reference": "b0cda757096cef5b73415fd1b685cc916a76838b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/doctrine-bridge/zipball/5803336d65b4c7de8185d8947e843810ec61012d", - "reference": "5803336d65b4c7de8185d8947e843810ec61012d", + "url": "https://api.github.com/repos/symfony/doctrine-bridge/zipball/b0cda757096cef5b73415fd1b685cc916a76838b", + "reference": "b0cda757096cef5b73415fd1b685cc916a76838b", "shasum": "" }, "require": { @@ -2811,20 +2848,20 @@ ], "description": "Symfony Doctrine Bridge", "homepage": "https://symfony.com", - "time": "2019-05-28T11:49:01+00:00" + "time": "2019-06-06T07:45:42+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v4.3.0", + "version": "v4.3.1", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "c71314cd3b9420b732e1526f33a24eff5430b5b3" + "reference": "4e6c670af81c4fb0b6c08b035530a9915d0b691f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/c71314cd3b9420b732e1526f33a24eff5430b5b3", - "reference": "c71314cd3b9420b732e1526f33a24eff5430b5b3", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/4e6c670af81c4fb0b6c08b035530a9915d0b691f", + "reference": "4e6c670af81c4fb0b6c08b035530a9915d0b691f", "shasum": "" }, "require": { @@ -2881,7 +2918,7 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2019-05-28T07:50:59+00:00" + "time": "2019-05-30T16:10:05+00:00" }, { "name": "symfony/event-dispatcher-contracts", @@ -2943,16 +2980,16 @@ }, { "name": "symfony/filesystem", - "version": "v4.3.0", + "version": "v4.3.1", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "988ab7d70c267c34efa85772ca20de3fad11c74b" + "reference": "bf2af40d738dec5e433faea7b00daa4431d0a4cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/988ab7d70c267c34efa85772ca20de3fad11c74b", - "reference": "988ab7d70c267c34efa85772ca20de3fad11c74b", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/bf2af40d738dec5e433faea7b00daa4431d0a4cf", + "reference": "bf2af40d738dec5e433faea7b00daa4431d0a4cf", "shasum": "" }, "require": { @@ -2989,11 +3026,11 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2019-05-24T12:50:04+00:00" + "time": "2019-06-03T20:27:40+00:00" }, { "name": "symfony/finder", - "version": "v4.3.0", + "version": "v4.3.1", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", @@ -3042,16 +3079,16 @@ }, { "name": "symfony/flex", - "version": "v1.2.5", + "version": "v1.2.6", "source": { "type": "git", "url": "https://github.com/symfony/flex.git", - "reference": "27909122a3da4676c3dc5dc34c8f82323c610d69" + "reference": "5ed49091eb73f912dd23dab92bf07c0180cfb009" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/flex/zipball/27909122a3da4676c3dc5dc34c8f82323c610d69", - "reference": "27909122a3da4676c3dc5dc34c8f82323c610d69", + "url": "https://api.github.com/repos/symfony/flex/zipball/5ed49091eb73f912dd23dab92bf07c0180cfb009", + "reference": "5ed49091eb73f912dd23dab92bf07c0180cfb009", "shasum": "" }, "require": { @@ -3087,20 +3124,20 @@ } ], "description": "Composer plugin for Symfony", - "time": "2019-05-07T08:10:46+00:00" + "time": "2019-06-05T14:26:30+00:00" }, { "name": "symfony/framework-bundle", - "version": "v4.3.0", + "version": "v4.3.1", "source": { "type": "git", "url": "https://github.com/symfony/framework-bundle.git", - "reference": "19714b45c7b5af238e66720017bae6fcf2d5fa01" + "reference": "fe407e6840d2b8f34c3fb67111e05c6d65319ef6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/framework-bundle/zipball/19714b45c7b5af238e66720017bae6fcf2d5fa01", - "reference": "19714b45c7b5af238e66720017bae6fcf2d5fa01", + "url": "https://api.github.com/repos/symfony/framework-bundle/zipball/fe407e6840d2b8f34c3fb67111e05c6d65319ef6", + "reference": "fe407e6840d2b8f34c3fb67111e05c6d65319ef6", "shasum": "" }, "require": { @@ -3209,20 +3246,20 @@ ], "description": "Symfony FrameworkBundle", "homepage": "https://symfony.com", - "time": "2019-05-30T03:17:01+00:00" + "time": "2019-06-06T08:35:06+00:00" }, { "name": "symfony/http-foundation", - "version": "v4.3.0", + "version": "v4.3.1", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "e8da078912bed1339f046c3a9488a5cbd0605971" + "reference": "b7e4945dd9b277cd24e93566e4da0a87956392a9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/e8da078912bed1339f046c3a9488a5cbd0605971", - "reference": "e8da078912bed1339f046c3a9488a5cbd0605971", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/b7e4945dd9b277cd24e93566e4da0a87956392a9", + "reference": "b7e4945dd9b277cd24e93566e4da0a87956392a9", "shasum": "" }, "require": { @@ -3264,20 +3301,20 @@ ], "description": "Symfony HttpFoundation Component", "homepage": "https://symfony.com", - "time": "2019-05-29T18:10:42+00:00" + "time": "2019-06-06T10:05:02+00:00" }, { "name": "symfony/http-kernel", - "version": "v4.3.0", + "version": "v4.3.1", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "b4ce396bdce518978a17324d3d39d61058d039e6" + "reference": "738ad561cd6a8d1c44ee1da941b2e628e264c429" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/b4ce396bdce518978a17324d3d39d61058d039e6", - "reference": "b4ce396bdce518978a17324d3d39d61058d039e6", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/738ad561cd6a8d1c44ee1da941b2e628e264c429", + "reference": "738ad561cd6a8d1c44ee1da941b2e628e264c429", "shasum": "" }, "require": { @@ -3356,20 +3393,20 @@ ], "description": "Symfony HttpKernel Component", "homepage": "https://symfony.com", - "time": "2019-05-30T06:21:08+00:00" + "time": "2019-06-06T13:23:34+00:00" }, { "name": "symfony/inflector", - "version": "v4.3.0", + "version": "v4.3.1", "source": { "type": "git", "url": "https://github.com/symfony/inflector.git", - "reference": "fc31c163077e75bb0b1055fe60a27f5c3cb9ae7c" + "reference": "889dc28cb6350ddb302fe9b8c796e4e6eb836856" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/inflector/zipball/fc31c163077e75bb0b1055fe60a27f5c3cb9ae7c", - "reference": "fc31c163077e75bb0b1055fe60a27f5c3cb9ae7c", + "url": "https://api.github.com/repos/symfony/inflector/zipball/889dc28cb6350ddb302fe9b8c796e4e6eb836856", + "reference": "889dc28cb6350ddb302fe9b8c796e4e6eb836856", "shasum": "" }, "require": { @@ -3414,7 +3451,7 @@ "symfony", "words" ], - "time": "2019-04-01T13:53:46+00:00" + "time": "2019-05-30T09:28:08+00:00" }, { "name": "symfony/maker-bundle", @@ -3484,16 +3521,16 @@ }, { "name": "symfony/mime", - "version": "v4.3.0", + "version": "v4.3.1", "source": { "type": "git", "url": "https://github.com/symfony/mime.git", - "reference": "0b166aee243364cd9de05755d2e9651876090abb" + "reference": "ec2c5565de60e03f33d4296a655e3273f0ad1f8b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mime/zipball/0b166aee243364cd9de05755d2e9651876090abb", - "reference": "0b166aee243364cd9de05755d2e9651876090abb", + "url": "https://api.github.com/repos/symfony/mime/zipball/ec2c5565de60e03f33d4296a655e3273f0ad1f8b", + "reference": "ec2c5565de60e03f33d4296a655e3273f0ad1f8b", "shasum": "" }, "require": { @@ -3539,7 +3576,7 @@ "mime", "mime-type" ], - "time": "2019-05-22T13:16:28+00:00" + "time": "2019-06-04T09:22:54+00:00" }, { "name": "symfony/orm-pack", @@ -3891,16 +3928,16 @@ }, { "name": "symfony/property-access", - "version": "v4.3.0", + "version": "v4.3.1", "source": { "type": "git", "url": "https://github.com/symfony/property-access.git", - "reference": "a14764290356f3fd17b65d2e98babc19b85e2814" + "reference": "18ea48862a39e364927e71b9e4942af3c1a1cb8c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/property-access/zipball/a14764290356f3fd17b65d2e98babc19b85e2814", - "reference": "a14764290356f3fd17b65d2e98babc19b85e2814", + "url": "https://api.github.com/repos/symfony/property-access/zipball/18ea48862a39e364927e71b9e4942af3c1a1cb8c", + "reference": "18ea48862a39e364927e71b9e4942af3c1a1cb8c", "shasum": "" }, "require": { @@ -3954,20 +3991,20 @@ "property path", "reflection" ], - "time": "2019-05-20T16:16:12+00:00" + "time": "2019-06-06T10:05:02+00:00" }, { "name": "symfony/routing", - "version": "v4.3.0", + "version": "v4.3.1", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "e6cc85f03102ef5e4aedfe636f83e58cf6fd7338" + "reference": "9b31cd24f6ad2cebde6845f6daa9c6d69efe2465" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/e6cc85f03102ef5e4aedfe636f83e58cf6fd7338", - "reference": "e6cc85f03102ef5e4aedfe636f83e58cf6fd7338", + "url": "https://api.github.com/repos/symfony/routing/zipball/9b31cd24f6ad2cebde6845f6daa9c6d69efe2465", + "reference": "9b31cd24f6ad2cebde6845f6daa9c6d69efe2465", "shasum": "" }, "require": { @@ -4030,20 +4067,20 @@ "uri", "url" ], - "time": "2019-05-20T16:16:12+00:00" + "time": "2019-06-05T09:16:20+00:00" }, { "name": "symfony/security-bundle", - "version": "v4.3.0", + "version": "v4.3.1", "source": { "type": "git", "url": "https://github.com/symfony/security-bundle.git", - "reference": "cb5ea7c36f0ee17ddd003dc3477d626281731115" + "reference": "ce3826058a4b1b892bb3b60e6f5019b44b079ddd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/security-bundle/zipball/cb5ea7c36f0ee17ddd003dc3477d626281731115", - "reference": "cb5ea7c36f0ee17ddd003dc3477d626281731115", + "url": "https://api.github.com/repos/symfony/security-bundle/zipball/ce3826058a4b1b892bb3b60e6f5019b44b079ddd", + "reference": "ce3826058a4b1b892bb3b60e6f5019b44b079ddd", "shasum": "" }, "require": { @@ -4114,20 +4151,20 @@ ], "description": "Symfony SecurityBundle", "homepage": "https://symfony.com", - "time": "2019-04-18T16:59:05+00:00" + "time": "2019-05-30T16:10:05+00:00" }, { "name": "symfony/security-core", - "version": "v4.3.0", + "version": "v4.3.1", "source": { "type": "git", "url": "https://github.com/symfony/security-core.git", - "reference": "b69e4898a4a2f950e24672836c9ecd40ca4883bb" + "reference": "7c1fc94098ce58452d28af4006b6870f8839d075" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/security-core/zipball/b69e4898a4a2f950e24672836c9ecd40ca4883bb", - "reference": "b69e4898a4a2f950e24672836c9ecd40ca4883bb", + "url": "https://api.github.com/repos/symfony/security-core/zipball/7c1fc94098ce58452d28af4006b6870f8839d075", + "reference": "7c1fc94098ce58452d28af4006b6870f8839d075", "shasum": "" }, "require": { @@ -4186,20 +4223,20 @@ ], "description": "Symfony Security Component - Core Library", "homepage": "https://symfony.com", - "time": "2019-05-27T08:16:38+00:00" + "time": "2019-06-03T20:27:40+00:00" }, { "name": "symfony/security-csrf", - "version": "v4.3.0", + "version": "v4.3.1", "source": { "type": "git", "url": "https://github.com/symfony/security-csrf.git", - "reference": "2ec1a4047302de6d0c4fb2cc377e578f530097c7" + "reference": "e7e3509ef7de66ea4970c75f9a0a72bf132d452e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/security-csrf/zipball/2ec1a4047302de6d0c4fb2cc377e578f530097c7", - "reference": "2ec1a4047302de6d0c4fb2cc377e578f530097c7", + "url": "https://api.github.com/repos/symfony/security-csrf/zipball/e7e3509ef7de66ea4970c75f9a0a72bf132d452e", + "reference": "e7e3509ef7de66ea4970c75f9a0a72bf132d452e", "shasum": "" }, "require": { @@ -4245,20 +4282,20 @@ ], "description": "Symfony Security Component - CSRF Library", "homepage": "https://symfony.com", - "time": "2019-01-16T21:53:39+00:00" + "time": "2019-05-30T16:10:05+00:00" }, { "name": "symfony/security-guard", - "version": "v4.3.0", + "version": "v4.3.1", "source": { "type": "git", "url": "https://github.com/symfony/security-guard.git", - "reference": "33621882e935a2b7fa558311ffe9a4f6b1b7ee9f" + "reference": "2177390e39f49e5ae0ac5765982fa32a4aeb536f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/security-guard/zipball/33621882e935a2b7fa558311ffe9a4f6b1b7ee9f", - "reference": "33621882e935a2b7fa558311ffe9a4f6b1b7ee9f", + "url": "https://api.github.com/repos/symfony/security-guard/zipball/2177390e39f49e5ae0ac5765982fa32a4aeb536f", + "reference": "2177390e39f49e5ae0ac5765982fa32a4aeb536f", "shasum": "" }, "require": { @@ -4299,20 +4336,20 @@ ], "description": "Symfony Security Component - Guard", "homepage": "https://symfony.com", - "time": "2019-04-07T18:20:37+00:00" + "time": "2019-05-30T16:10:05+00:00" }, { "name": "symfony/security-http", - "version": "v4.3.0", + "version": "v4.3.1", "source": { "type": "git", "url": "https://github.com/symfony/security-http.git", - "reference": "13594beb3faaeea891aaae9eeea8ffde16a99faf" + "reference": "8e8d92dc843be9855d6c1b1dbbe95d0477d1dfc6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/security-http/zipball/13594beb3faaeea891aaae9eeea8ffde16a99faf", - "reference": "13594beb3faaeea891aaae9eeea8ffde16a99faf", + "url": "https://api.github.com/repos/symfony/security-http/zipball/8e8d92dc843be9855d6c1b1dbbe95d0477d1dfc6", + "reference": "8e8d92dc843be9855d6c1b1dbbe95d0477d1dfc6", "shasum": "" }, "require": { @@ -4364,7 +4401,7 @@ ], "description": "Symfony Security Component - HTTP Integration", "homepage": "https://symfony.com", - "time": "2019-05-26T20:47:49+00:00" + "time": "2019-06-05T13:25:51+00:00" }, { "name": "symfony/service-contracts", @@ -4426,7 +4463,7 @@ }, { "name": "symfony/stopwatch", - "version": "v4.3.0", + "version": "v4.3.1", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", @@ -4533,16 +4570,16 @@ }, { "name": "symfony/twig-bridge", - "version": "v4.3.0", + "version": "v4.3.1", "source": { "type": "git", "url": "https://github.com/symfony/twig-bridge.git", - "reference": "5ed4b37b36e37baeb36028e2e27725c571853444" + "reference": "52aa76480b775be0f6465b90ca9e3c2dccc8f3cd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/twig-bridge/zipball/5ed4b37b36e37baeb36028e2e27725c571853444", - "reference": "5ed4b37b36e37baeb36028e2e27725c571853444", + "url": "https://api.github.com/repos/symfony/twig-bridge/zipball/52aa76480b775be0f6465b90ca9e3c2dccc8f3cd", + "reference": "52aa76480b775be0f6465b90ca9e3c2dccc8f3cd", "shasum": "" }, "require": { @@ -4627,20 +4664,20 @@ ], "description": "Symfony Twig Bridge", "homepage": "https://symfony.com", - "time": "2019-05-28T09:03:44+00:00" + "time": "2019-06-01T07:11:44+00:00" }, { "name": "symfony/twig-bundle", - "version": "v4.3.0", + "version": "v4.3.1", "source": { "type": "git", "url": "https://github.com/symfony/twig-bundle.git", - "reference": "2792936cbcd92267596363b67b5cebb5e347af59" + "reference": "b8e1c193a474b97b608de74fe0a01214678bfd89" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/twig-bundle/zipball/2792936cbcd92267596363b67b5cebb5e347af59", - "reference": "2792936cbcd92267596363b67b5cebb5e347af59", + "url": "https://api.github.com/repos/symfony/twig-bundle/zipball/b8e1c193a474b97b608de74fe0a01214678bfd89", + "reference": "b8e1c193a474b97b608de74fe0a01214678bfd89", "shasum": "" }, "require": { @@ -4703,20 +4740,20 @@ ], "description": "Symfony TwigBundle", "homepage": "https://symfony.com", - "time": "2019-05-10T08:01:19+00:00" + "time": "2019-05-30T16:10:05+00:00" }, { "name": "symfony/validator", - "version": "v4.3.0", + "version": "v4.3.1", "source": { "type": "git", "url": "https://github.com/symfony/validator.git", - "reference": "6ad0600c5a4bb673a627533f88b77b2af43e71b7" + "reference": "ea74d2843fd8a9f2d4800136c985d13da586a405" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/validator/zipball/6ad0600c5a4bb673a627533f88b77b2af43e71b7", - "reference": "6ad0600c5a4bb673a627533f88b77b2af43e71b7", + "url": "https://api.github.com/repos/symfony/validator/zipball/ea74d2843fd8a9f2d4800136c985d13da586a405", + "reference": "ea74d2843fd8a9f2d4800136c985d13da586a405", "shasum": "" }, "require": { @@ -4795,20 +4832,20 @@ ], "description": "Symfony Validator Component", "homepage": "https://symfony.com", - "time": "2019-05-29T13:02:41+00:00" + "time": "2019-06-03T20:27:40+00:00" }, { "name": "symfony/var-dumper", - "version": "v4.3.0", + "version": "v4.3.1", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "2fd2ecf7913fb96f0c2e941ca15bb702184c6574" + "reference": "f974f448154928d2b5fb7c412bd23b81d063f34b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/2fd2ecf7913fb96f0c2e941ca15bb702184c6574", - "reference": "2fd2ecf7913fb96f0c2e941ca15bb702184c6574", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/f974f448154928d2b5fb7c412bd23b81d063f34b", + "reference": "f974f448154928d2b5fb7c412bd23b81d063f34b", "shasum": "" }, "require": { @@ -4871,11 +4908,11 @@ "debug", "dump" ], - "time": "2019-05-01T12:55:49+00:00" + "time": "2019-06-05T02:08:12+00:00" }, { "name": "symfony/var-exporter", - "version": "v4.3.0", + "version": "v4.3.1", "source": { "type": "git", "url": "https://github.com/symfony/var-exporter.git", @@ -4935,16 +4972,16 @@ }, { "name": "symfony/web-profiler-bundle", - "version": "v4.3.0", + "version": "v4.3.1", "source": { "type": "git", "url": "https://github.com/symfony/web-profiler-bundle.git", - "reference": "b371e362dada3c1fcd9e7f7a31a91bd681860331" + "reference": "ca3a3c8558bc641df7c8c2c546381ccd78d0777a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/web-profiler-bundle/zipball/b371e362dada3c1fcd9e7f7a31a91bd681860331", - "reference": "b371e362dada3c1fcd9e7f7a31a91bd681860331", + "url": "https://api.github.com/repos/symfony/web-profiler-bundle/zipball/ca3a3c8558bc641df7c8c2c546381ccd78d0777a", + "reference": "ca3a3c8558bc641df7c8c2c546381ccd78d0777a", "shasum": "" }, "require": { @@ -4997,11 +5034,11 @@ ], "description": "Symfony WebProfilerBundle", "homepage": "https://symfony.com", - "time": "2019-05-26T20:47:49+00:00" + "time": "2019-05-30T16:10:05+00:00" }, { "name": "symfony/yaml", - "version": "v4.3.0", + "version": "v4.3.1", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", @@ -5296,34 +5333,35 @@ }, { "name": "doctrine/doctrine-fixtures-bundle", - "version": "3.1.0", + "version": "3.2.0", "source": { "type": "git", "url": "https://github.com/doctrine/DoctrineFixturesBundle.git", - "reference": "f016565b251c2dfa32a8d6da44d1650dc9ec1498" + "reference": "13b2e8e1af099bc06f8611497fe079a4e0b4e497" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/DoctrineFixturesBundle/zipball/f016565b251c2dfa32a8d6da44d1650dc9ec1498", - "reference": "f016565b251c2dfa32a8d6da44d1650dc9ec1498", + "url": "https://api.github.com/repos/doctrine/DoctrineFixturesBundle/zipball/13b2e8e1af099bc06f8611497fe079a4e0b4e497", + "reference": "13b2e8e1af099bc06f8611497fe079a4e0b4e497", "shasum": "" }, "require": { "doctrine/data-fixtures": "^1.3", "doctrine/doctrine-bundle": "^1.6", + "doctrine/orm": "^2.6.0", "php": "^7.1", "symfony/doctrine-bridge": "~3.4|^4.1", "symfony/framework-bundle": "^3.4|^4.1" }, "require-dev": { - "doctrine/coding-standard": "^5.0", + "doctrine/coding-standard": "^6.0", "phpunit/phpunit": "^7.4", "symfony/phpunit-bridge": "^4.1" }, "type": "symfony-bundle", "extra": { "branch-alias": { - "dev-master": "3.1.x-dev" + "dev-master": "3.2.x-dev" } }, "autoload": { @@ -5355,11 +5393,11 @@ "Fixture", "persistence" ], - "time": "2018-12-21T10:10:51+00:00" + "time": "2019-06-07T11:21:53+00:00" }, { "name": "symfony/dotenv", - "version": "v4.3.0", + "version": "v4.3.1", "source": { "type": "git", "url": "https://github.com/symfony/dotenv.git", @@ -5461,7 +5499,8 @@ "aliases": [], "minimum-stability": "stable", "stability-flags": { - "catalyst/auth-bundle": 20 + "catalyst/auth-bundle": 20, + "catalyst/menu-bundle": 20 }, "prefer-stable": false, "prefer-lowest": false, diff --git a/symfony.lock b/symfony.lock index 3ad7b9b2..dbf607a5 100644 --- a/symfony.lock +++ b/symfony.lock @@ -2,6 +2,9 @@ "catalyst/auth-bundle": { "version": "dev-master" }, + "catalyst/menu-bundle": { + "version": "dev-master" + }, "creof/doctrine2-spatial": { "version": "1.2.0" },