コード例 #1
0
 /**
  * @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')));
     }
 }
コード例 #2
0
 /**
  * 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());
 }