getCategories() public method

public getCategories ( ) : Doctrine\Common\Collections\Collection
return Doctrine\Common\Collections\Collection
コード例 #1
0
 private function addBreadcrumbs(ProductInterface $product)
 {
     $category = $product->getCategories()->last();
     $paths = $this->get('category.repository')->getCategoryPath($category);
     /** @var CategoryInterface $path */
     foreach ($paths as $path) {
         $this->getBreadcrumbProvider()->add(new Breadcrumb(['label' => $path->translate()->getName(), 'url' => $this->getRouterHelper()->generateUrl($path->translate()->getRoute()->getId())]));
     }
     $this->getBreadcrumbProvider()->add(new Breadcrumb(['label' => $product->translate()->getName()]));
 }