public function viewAction($id)
    {
        /** @var BlockManager $manager */
        $manager = $this->get('opifer.content.block_manager');

        /** @var BlockInterface $block */
        $block = $manager->getRepository()->find($id);

        if (!$block) {
            throw $this->createNotFoundException();
        }

        $response = new Response();

        /** @var Environment $environment */
        $environment = $this->get('opifer.content.block_environment');
        $environment->setObject($block->getOwner());

        $service = $manager->getService($block);

        $response = $service->execute($block, $response, [
            'partial' => true,
            'environment' => $environment
        ]);

        return $response;
    }
public function viewAction($id)
    {
        /** @var BlockManager $manager */
        $manager = $this->get('opifer.content.block_manager');

        /** @var BlockInterface $block */
        $block = $manager->getRepository()->find($id);

        if (!$block) {
            throw $this->createNotFoundException();
        }

        $response = new Response();

        /** @var Environment $environment */
        $environment = $this->get('opifer.content.block_environment');
        $environment->setObject($block->getOwner());

        $service = $manager->getService($block);

        $response = $service->execute($block, $response, [
            'partial' => true,
            'environment' => $environment
        ]);

        return $response;
    }
public function viewAction ( $ id ) { /** @var BlockManager $manager */ $ manager = $ this -> get ( 'opifer.content.block_manager' ) ; /** @var BlockInterface $block */ $ block = $ manager -> getRepository ( ) -> find ( $ id ) ; if ( ! $ block ) { throw $ this -> createNotFoundException ( ) ; } $ response = new Response ( ) ; /** @var Environment $environment */ $ environment = $ this -> get ( 'opifer.content.block_environment' ) ; $ environment -> setObject ( $ block -> getOwner ( ) ) ; $ service = $ manager -> getService ( $ block ) ; $ response = $ service -> execute ( $ block , $ response , [ 'partial' => true , 'environment' => $ environment ] ) ; return $ response ; }
Renders a single block

Useful for Edge Side Includes (ESI)

@param $id

@return Response
Renders a single block