Inheritance: extends PartKeepr\CategoryBundle\Entity\AbstractCategory, implements PartKeepr\CategoryBundle\Entity\CategoryPathInterface
 /**
  * Recursively updates the category paths.
  *
  * @param PartCategory  $partCategory  The footprint category to update
  * @param EntityManager $entityManager The entity manager
  */
 public function updateCategoryPaths(PartCategory $partCategory, OnFlushEventArgs $eventArgs)
 {
     $entityManager = $eventArgs->getEntityManager();
     $pathSeparator = $this->container->getParameter("partkeepr.category.path_separator");
     $partCategory->setCategoryPath($partCategory->generateCategoryPath($pathSeparator));
     $entityManager->getUnitOfWork()->recomputeSingleEntityChangeSet($entityManager->getClassMetadata(get_class($partCategory)), $partCategory);
     foreach ($partCategory->getChildren() as $child) {
         $this->updateCategoryPaths($child, $eventArgs);
     }
 }
Example #2
0
 /**
  * Returns the category path
  * @Groups({"default"})
  *
  * @return string
  */
 public function getCategoryPath()
 {
     if ($this->category !== null) {
         return $this->category->getCategoryPath();
     } else {
         return "";
     }
 }