/** * @return string */ public function getWishlists() { if (null === $this->wishlists) { // Get customer $customer = $this->getCustomer(); if ($customer) { $this->wishlists = $this->wishlistRepository->getWishlistsForCustomer($customer); } } return $this->wishlists; }
/** * Add menu items for the account section. * * @param MenuBuilderEvent $event */ public function addAccountMenuItems(MenuBuilderEvent $event) { // Get the menu $menu = $event->getMenu(); // Set route and label, depending on multiple wishlist mode if ($this->multipleWishlistMode) { $route = 'webburza_wishlist_account_index'; $routeParameters = []; $label = $this->translate('webburza.sylius.wishlist.frontend.my_wishlists'); } else { // Get the current customer $customer = $this->getCustomer(); if (!$customer) { return; } // Get the first wishlist for the user $wishlist = $this->wishlistRepository->getFirstForCustomer($customer); if (!$wishlist) { return; } $route = 'webburza_wishlist_account_edit'; $routeParameters = ['id' => $wishlist->getId()]; $label = $this->translate('webburza.sylius.wishlist.frontend.my_wishlist'); } // Add menu item to the menu $menu->addChild('wishlists', ['route' => $route, 'routeParameters' => $routeParameters, 'linkAttributes' => ['title' => $label], 'labelAttributes' => ['icon' => 'icon-star', 'iconOnly' => false]])->setLabel($label); }