PartKeepr\StorageLocationBundle\Listeners\CategoryPathListener::updateCategoryPaths PHP Method

updateCategoryPaths() public method

Recursively updates the category paths.
public updateCategoryPaths ( StorageLocationCategory $storageLocationCategory, Doctrine\ORM\Event\OnFlushEventArgs $eventArgs )
$storageLocationCategory PartKeepr\StorageLocationBundle\Entity\StorageLocationCategory The storage location category to update
$eventArgs Doctrine\ORM\Event\OnFlushEventArgs
    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);
        }
    }