/** * 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); } }
/** * Returns the category path * @Groups({"default"}) * * @return string */ public function getCategoryPath() { if ($this->category !== null) { return $this->category->getCategoryPath(); } else { return ""; } }