PartKeepr\StorageLocationBundle\Entity\StorageLocationCategory::setCategoryPath PHP Method

setCategoryPath() public method

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

Usage Example

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