/**
  * @param HasPageTemplateInterface $page
  *
  * @throws \Exception
  * @return PageTemplateInterface[]
  */
 public function getPageTemplates(HasPageTemplateInterface $page)
 {
     $pageTemplates = [];
     foreach ($page->getPageTemplates() as $pageTemplate) {
         if (is_string($pageTemplate)) {
             $pt = $this->parser->parse($pageTemplate);
         } elseif ($pageTemplate instanceof PageTemplateInterface) {
             $pt = $pageTemplate;
         } else {
             throw new \Exception("don't know how to handle the pageTemplate " . get_class($pageTemplate));
         }
         $pageTemplates[$pt->getName()] = $pt;
     }
     return $pageTemplates;
 }
 /**
  * @param HasPageTemplateInterface $page
  *
  * @return PageTemplateConfiguration
  */
 public function findFor(HasPageTemplateInterface $page)
 {
     return $this->findOneBy(array('pageId' => $page->getId(), 'pageEntityName' => ClassLookup::getClass($page)));
 }