/** * @param \Sonata\PageBundle\CmsManager\CmsManagerInterface $manager * @param \Sonata\PageBundle\Model\BlockInterface $block * @return void */ public function load(CmsManagerInterface $manager, BlockInterface $block) { if (is_numeric($block->getSetting('pageId'))) { $block->setSetting('pageId', $manager->getPage($block->getSetting('pageId'))); } }
/** * Returns the cache keys for the block * * @param \Sonata\PageBundle\CmsManager\CmsManagerInterface $manager * @param \Sonata\PageBundle\Model\BlockInterface $block * @return \Sonata\PageBundle\Cache\CacheElement */ public function getCacheElement(CmsManagerInterface $manager, BlockInterface $block) { $baseCacheKeys = array('manager' => $manager->getCode(), 'block_id' => $block->getId(), 'page_id' => $block->getPage()->getId(), 'updated_at' => $block->getUpdatedAt()->format('U')); return new CacheElement($baseCacheKeys, $block->getTtl()); }