Пример #1
0
 /**
  * Retrieves Block with id $id or throws an exception if it doesn't exist.
  *
  * @param $id
  *
  * @return BlockInterface
  *
  * @throws NotFoundHttpException
  */
 protected function getBlock($id)
 {
     $block = $this->blockManager->findOneBy(array('id' => $id));
     if (null === $block) {
         throw new NotFoundHttpException(sprintf('Block (%d) not found', $id));
     }
     return $block;
 }
 /**
  * {@inheritdoc}
  */
 public function load(BlockInterface $block)
 {
     $sharedBlock = $block->getSetting('blockId', null);
     if (is_int($sharedBlock)) {
         $sharedBlock = $this->blockManager->findOneBy(array('id' => $sharedBlock));
     }
     $block->setSetting('blockId', $sharedBlock);
 }