Skip to content

Commit

Permalink
Update PageListener.php
Browse files Browse the repository at this point in the history
refresh object to maintain template changes when path changes
  • Loading branch information
ychadwick authored Oct 26, 2020
1 parent 0e4d31e commit f79f787
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/Entity/PageListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public function onFlush(OnFlushEventArgs $args)
foreach ($unitOfWork->getScheduledEntityUpdates() as $entity) {
if ($entity instanceof PageInterface) {
if ($contentRoute = $entity->getContentRoute()) {
$em->refresh($contentRoute);
$contentRoute->setPath(PageHelper::getPageRoutePath($entity->getPath()));
$em->persist($contentRoute);
$unitOfWork->computeChangeSet($em->getClassMetadata(get_class($contentRoute)), $contentRoute);
Expand Down

0 comments on commit f79f787

Please sign in to comment.