Skip to content

Commit

Permalink
Add container to repo to avoid method on non object error
Browse files Browse the repository at this point in the history
  • Loading branch information
Kim Ausloos committed May 9, 2014
1 parent dda587c commit c8233a4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion EventListener/CloneListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ public function postDeepCloneAndSave(DeepCloneAndSaveEvent $event)
}
if ($originalEntity instanceof HasPageTemplateInterface) {
$clonedEntity = $event->getClonedEntity();
$newPageTemplateConfiguration = clone $this->em->getRepository('KunstmaanPagePartBundle:PageTemplateConfiguration')->findOrCreateFor($originalEntity);
$PageTemplateConfigurationRepo = $this->em->getRepository('KunstmaanPagePartBundle:PageTemplateConfiguration');
$PageTemplateConfigurationRepo->setContainer($this->kernel->getContainer());
$newPageTemplateConfiguration = clone $PageTemplateConfigurationRepo->findOrCreateFor($originalEntity);
$newPageTemplateConfiguration->setId(null);
$newPageTemplateConfiguration->setPageId($clonedEntity->getId());
$this->em->persist($newPageTemplateConfiguration);
Expand Down

0 comments on commit c8233a4

Please sign in to comment.