PartKeepr\PartBundle\Entity\PartCategory::setCategoryPath PHP Méthode

setCategoryPath() public méthode

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

Usage Example

 /**
  * 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);
     }
 }