class MenuItemManager implements BasicEntityManagerInterface

Class MenuItemManager is injected as alligator.menu_item_manager service. MenuItemManager handles the logic for managed entity.

Constants

MENU_ITEMS_TREE

Methods

__construct(MenuItemRepository $itemRepository, EventDispatcherInterface $dispatcher, ContainerInterface $container)

MenuItemManager constructor.

saveItem(MenuItem $menuItem)

Persist new menu item as last child of ROOT node, and dispatch event for re-caching

changeNested(stdClass $menuItem)

Update existing menu item, and dispatch event for re-caching

array
getAll(string $locale)

Find all menu items for provided locale

mixed
removeNestedFromTree(int $id)

Remove menu link that match provided id, set replacement link if exist and dispatch event for re-caching

mixed
getMenuLinks()

No description

mixed
getMenuItemImages()

Find all images used in menu items

array
getMenuItemsByParams(array $params)

Find all menu items that match provide parameters

simpleUpdate(MenuItem $item)

Update existing menu item

array|string
getAllMenuTree(array $options, string $locale)

Find all menu items as html

string
getRouteForNode(MenuItem|array $node, string $locale)

Generate route for node

string
generateRoute(string $routeName, array $data)

Generate route for provided route name and parameters

string
getCashMenuTree(string|null $locale = null)

Retrieve cached menu item tree html for provided locale

string
getResponsiveCashMenuTree(string|null $locale = null)

Retrieve cached responsive menu item tree html for provided locale

string
setCashMenuTree(mixed $data, string|null $locale = null)

Set menu item tree html to cache for provided locale

mixed
setResponsiveCashMenuTree(mixed $data, string|null $locale = null)

Set responsive menu item tree html to cache for provided locale

string
getDefaultLocale()

No description

array
getAvailableLanguages()

No description

dispatchMenuTreeDecoratorEvent(MenuItem|null $menuItem = null, string|null $locale = null)

No description

Event
dispatchMenuDecoratorOptionsEvent(string|null $locale = null)

No description

array
getAllFirstLevelItems(string $locale)

Find all menu items that match provided locale

Details

at line 54
__construct(MenuItemRepository $itemRepository, EventDispatcherInterface $dispatcher, ContainerInterface $container)

MenuItemManager constructor.

Parameters

MenuItemRepository $itemRepository
EventDispatcherInterface $dispatcher
ContainerInterface $container

at line 70
MenuItem saveItem(MenuItem $menuItem)

Persist new menu item as last child of ROOT node, and dispatch event for re-caching

Parameters

MenuItem $menuItem

Return Value

MenuItem

Exceptions

ORMException
OptimisticLockException

at line 85
MenuItem changeNested(stdClass $menuItem)

Update existing menu item, and dispatch event for re-caching

Parameters

stdClass $menuItem

Return Value

MenuItem

at line 99
array getAll(string $locale)

Find all menu items for provided locale

Parameters

string $locale

Return Value

array

at line 112
mixed removeNestedFromTree(int $id)

Remove menu link that match provided id, set replacement link if exist and dispatch event for re-caching

Parameters

int $id

Return Value

mixed

Exceptions

ORMException

Return Value

mixed

at line 140
mixed getMenuItemImages()

Find all images used in menu items

Return Value

mixed

at line 164
array getMenuItemsByParams(array $params)

Find all menu items that match provide parameters

Parameters

array $params Array of condition => value

Return Value

array

at line 179
MenuItem simpleUpdate(MenuItem $item)

Update existing menu item

Parameters

MenuItem $item

Return Value

MenuItem

Exceptions

ORMException
OptimisticLockException

at line 191
array|string getAllMenuTree(array $options, string $locale)

Find all menu items as html

Parameters

array $options
string $locale

Return Value

array|string

at line 208
string getRouteForNode(MenuItem|array $node, string $locale)

Generate route for node

Parameters

MenuItem|array $node
string $locale

Return Value

string

at line 238
string generateRoute(string $routeName, array $data)

Generate route for provided route name and parameters

Parameters

string $routeName
array $data

Return Value

string

at line 253
string getCashMenuTree(string|null $locale = null)

Retrieve cached menu item tree html for provided locale

Parameters

string|null $locale

Return Value

string

at line 266
string getResponsiveCashMenuTree(string|null $locale = null)

Retrieve cached responsive menu item tree html for provided locale

Parameters

string|null $locale

Return Value

string

at line 280
string setCashMenuTree(mixed $data, string|null $locale = null)

Set menu item tree html to cache for provided locale

Parameters

mixed $data
string|null $locale

Return Value

string

at line 294
mixed setResponsiveCashMenuTree(mixed $data, string|null $locale = null)

Set responsive menu item tree html to cache for provided locale

Parameters

mixed $data
string|null $locale

Return Value

mixed

at line 304
string getDefaultLocale()

Return Value

string

at line 312
array getAvailableLanguages()

Return Value

array

at line 321
dispatchMenuTreeDecoratorEvent(MenuItem|null $menuItem = null, string|null $locale = null)

Parameters

MenuItem|null $menuItem
string|null $locale

at line 335
Event dispatchMenuDecoratorOptionsEvent(string|null $locale = null)

Parameters

string|null $locale

Return Value

Event

at line 346
array getAllFirstLevelItems(string $locale)

Find all menu items that match provided locale

Parameters

string $locale

Return Value

array