/**
  * @param \Sonata\PageBundle\Model\SnapshotInterface $snapshot
  * @return \Sonata\PageBundle\Model\PageInterface
  */
 public function load(SnapshotInterface $snapshot)
 {
     $page = new Page();
     $page->setRouteName($snapshot->getRouteName());
     $page->setCustomUrl($snapshot->getUrl());
     $page->setUrl($snapshot->getUrl());
     $page->setPosition($snapshot->getPosition());
     $page->setDecorate($snapshot->getDecorate());
     $content = json_decode($snapshot->getContent(), true);
     $page->setId($content['id']);
     $page->setJavascript($content['javascript']);
     $page->setStylesheet($content['stylesheet']);
     $page->setRawHeaders($content['raw_headers']);
     $page->setMetaDescription($content['meta_description']);
     $page->setMetaKeyword($content['meta_keyword']);
     $page->setName($content['name']);
     $page->setSlug($content['slug']);
     $page->setTemplateCode($content['template_code']);
     $page->setRequestMethod($content['request_method']);
     $createdAt = new \DateTime();
     $createdAt->setTimestamp($content['created_at']);
     $page->setCreatedAt($createdAt);
     $updatedAt = new \DateTime();
     $updatedAt->setTimestamp($content['updated_at']);
     $page->setUpdatedAt($updatedAt);
     return $page;
 }
 /**
  * {@inheritdoc}
  */
 public function load(SnapshotInterface $snapshot)
 {
     $page = $this->pageManager->create();
     $page->setRouteName($snapshot->getRouteName());
     $page->setPageAlias($snapshot->getPageAlias());
     $page->setType($snapshot->getType());
     $page->setCustomUrl($snapshot->getUrl());
     $page->setUrl($snapshot->getUrl());
     $page->setPosition($snapshot->getPosition());
     $page->setDecorate($snapshot->getDecorate());
     $page->setSite($snapshot->getSite());
     $page->setEnabled($snapshot->getEnabled());
     $content = $this->fixPageContent($snapshot->getContent());
     $icon = $content['icon_id'] ? $this->registry->getManager()->getRepository('SymbioOrangeGateMediaBundle:Media')->findOneById($content['icon_id']) : null;
     $page->setId($content['id']);
     $page->setJavascript($content['javascript']);
     $page->setStylesheet($content['stylesheet']);
     $page->setRawHeaders($content['raw_headers']);
     $page->setTitle($content['title']);
     $page->setDescription($content['description']);
     $page->setIcon($icon);
     $page->setMetaDescription($content['meta_description']);
     $page->setMetaKeyword($content['meta_keyword']);
     $page->setName($content['name']);
     $page->setSlug($content['slug']);
     $page->setTemplateCode($content['template_code']);
     $page->setRequestMethod($content['request_method']);
     if (array_key_exists('cssClass', $content)) {
         $page->setCssClass($content['cssClass']);
     }
     $createdAt = new \DateTime();
     $createdAt->setTimestamp($content['created_at']);
     $page->setCreatedAt($createdAt);
     $updatedAt = new \DateTime();
     $updatedAt->setTimestamp($content['updated_at']);
     $page->setUpdatedAt($updatedAt);
     foreach ($snapshot->getTranslations() as $locale => $strans) {
         $ptrans = new PageTranslation();
         $ptrans->setObject($page);
         $ptrans->setLocale($locale);
         $ptrans->setEnabled($strans->getEnabled());
         $ptrans->setName($strans->getName());
         $ptrans->setUrl($strans->getUrl());
         $content = $strans->getContent();
         $ptrans->setObject($page);
         $ptrans->setLocale($locale);
         $ptrans->setTitle($content['title']);
         $ptrans->setDescription($content['description']);
         $ptrans->setMetaDescription($content['meta_description']);
         $ptrans->setMetaKeyword($content['meta_keyword']);
         $ptrans->setName($content['name']);
         $ptrans->setSlug($content['slug']);
         $page->addTranslation($ptrans);
     }
     return $page;
 }