PartKeepr\FootprintBundle\Entity\FootprintCategory::setCategoryPath PHP Method

setCategoryPath() public method

public setCategoryPath ( $categoryPath )
    public function setCategoryPath($categoryPath)
    {
        $this->categoryPath = $categoryPath;
    }

Usage Example

 /**
  * Recursively updates the category paths.
  *
  * @param FootprintCategory $footprintCategory The footprint category to update
  * @param EntityManager     $entityManager     The entity manager
  */
 public function updateCategoryPaths(FootprintCategory $footprintCategory, OnFlushEventArgs $eventArgs)
 {
     $entityManager = $eventArgs->getEntityManager();
     $pathSeparator = $this->container->getParameter("partkeepr.category.path_separator");
     $footprintCategory->setCategoryPath($footprintCategory->generateCategoryPath($pathSeparator));
     $entityManager->getUnitOfWork()->recomputeSingleEntityChangeSet($entityManager->getClassMetadata(get_class($footprintCategory)), $footprintCategory);
     foreach ($footprintCategory->getChildren() as $child) {
         $this->updateCategoryPaths($child, $eventArgs);
     }
 }