src/bundles/BlockBundle/Controller/BlockController.php
public function renderAction(Request $request)
    {

        //TODO: render initial block via ajax
        $blockType = $request->get('blockType', null);
        $action    = $request->get('action', null);

        // merge all parameters
        $params = array_merge($request->request->all(), $request->query->all());

        // load block service
        $block = $this->getBlockServiceManager()->getService($blockType);
        if (!$block) {
            throw $this->createNotFoundException(sprintf('Cannot find block service "%s"', $blockType));
        }

        if(!$block instanceof AbstractAdminBlockService) {
            throw new \Exception('Block should be an instance of AbstractAdminBlockService');
        }

        $params['block'] = $block;

        $methodName = sprintf("%sAction", $action);

        if (!is_callable(array($block, $methodName), false)) {
            throw $this->createNotFoundException(sprintf('Cannot find method "%s" in block service "%s"', $methodName, $blockType));
        }

        return call_user_func_array(array($block, $methodName), array($request, $params));
    }
public function renderAction(Request $request)
    {

        //TODO: render initial block via ajax
        $blockType = $request->get('blockType', null);
        $action    = $request->get('action', null);

        // merge all parameters
        $params = array_merge($request->request->all(), $request->query->all());

        // load block service
        $block = $this->getBlockServiceManager()->getService($blockType);
        if (!$block) {
            throw $this->createNotFoundException(sprintf('Cannot find block service "%s"', $blockType));
        }

        if(!$block instanceof AbstractAdminBlockService) {
            throw new \Exception('Block should be an instance of AbstractAdminBlockService');
        }

        $params['block'] = $block;

        $methodName = sprintf("%sAction", $action);

        if (!is_callable(array($block, $methodName), false)) {
            throw $this->createNotFoundException(sprintf('Cannot find method "%s" in block service "%s"', $methodName, $blockType));
        }

        return call_user_func_array(array($block, $methodName), array($request, $params));
    }
public function renderAction ( Request $ request ) { //TODO: render initial block via ajax $ blockType = $ request -> get ( 'blockType' , null ) ; $ action = $ request -> get ( 'action' , null ) ; // merge all parameters $ params = array_merge ( $ request -> request -> all ( ) , $ request -> query -> all ( ) ) ; // load block service $ block = $ this -> getBlockServiceManager ( ) -> getService ( $ blockType ) ; if ( ! $ block ) { throw $ this -> createNotFoundException ( sprintf ( 'Cannot find block service "%s"' , $ blockType ) ) ; } if ( ! $ block instanceof AbstractAdminBlockService ) { throw new \ Exception ( 'Block should be an instance of AbstractAdminBlockService' ) ; } $ params [ 'block' ] = $ block ; $ methodName = sprintf ( "%sAction" , $ action ) ; if ( ! is_callable ( array ( $ block , $ methodName ) , false ) ) { throw $ this -> createNotFoundException ( sprintf ( 'Cannot find method "%s" in block service "%s"' , $ methodName , $ blockType ) ) ; } return call_user_func_array ( array ( $ block , $ methodName ) , array ( $ request , $ params ) ) ; }
Default render action

@param Request $request
@return mixed
@throws \Exception
Default render action