partkeepr

fork of partkeepr
git clone https://git.e1e0.net/partkeepr.git
Log | Files | Refs | Submodules | README | LICENSE

commit 35873d8f9a1a95bfa6e6ab69c2ebca2dbc863876
parent 1a125c41ecf5675c533d8004d23fcca0b8d5eece
Author: Felicitus <felicitus@felicitus.org>
Date:   Mon, 20 Jul 2015 00:47:18 +0200

Refactored the updateCategoryPaths method to not include the EntityManager, because Sensio Insight doesn't like that

Diffstat:
Msrc/PartKeepr/FootprintBundle/Listeners/CategoryPathListener.php | 8+++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/PartKeepr/FootprintBundle/Listeners/CategoryPathListener.php b/src/PartKeepr/FootprintBundle/Listeners/CategoryPathListener.php @@ -20,7 +20,7 @@ class CategoryPathListener extends ContainerAware foreach ($uow->getScheduledEntityUpdates() as $updated) { if ($updated instanceof FootprintCategory) { - $this->updateCategoryPaths($updated, $entityManager); + $this->updateCategoryPaths($updated, $eventArgs); } } } @@ -31,8 +31,10 @@ class CategoryPathListener extends ContainerAware * @param FootprintCategory $footprintCategory The footprint category to update * @param EntityManager $entityManager The entity manager */ - public function updateCategoryPaths(FootprintCategory $footprintCategory, EntityManager $entityManager) + public function updateCategoryPaths(FootprintCategory $footprintCategory, OnFlushEventArgs $eventArgs) { + $entityManager = $eventArgs->getEntityManager(); + $footprintCategory->setCategoryPath($footprintCategory->generateCategoryPath()); $entityManager->getUnitOfWork()->recomputeSingleEntityChangeSet( @@ -41,7 +43,7 @@ class CategoryPathListener extends ContainerAware ); foreach ($footprintCategory->getChildren() as $child) { - $this->updateCategoryPaths($child, $entityManager); + $this->updateCategoryPaths($child, $eventArgs); } } }