public function createContainerAction(Request $request)
    {
        $content = $this->findContentByRequest($request);
        $type = $request->request->get('type', null);

        try {
            $container = $this->getEditor()->createDefaultContainer($type, [], $content);
        } catch (EditorExceptionInterface $e) {
            return $this->handleException($e);
        }

        $this->validate($content);
        $this->persist($content);

        $viewBuilder = $this->getViewBuilder();

        $data = [
            'created' => $viewBuilder->buildContainer($container)->getAttributes()->getId(),
            'content' => $viewBuilder->buildContent($content),
        ];

        return $this->buildResponse($data, self::SERIALIZE_FULL);
    }
public function createContainerAction(Request $request)
    {
        $content = $this->findContentByRequest($request);
        $type = $request->request->get('type', null);

        try {
            $container = $this->getEditor()->createDefaultContainer($type, [], $content);
        } catch (EditorExceptionInterface $e) {
            return $this->handleException($e);
        }

        $this->validate($content);
        $this->persist($content);

        $viewBuilder = $this->getViewBuilder();

        $data = [
            'created' => $viewBuilder->buildContainer($container)->getAttributes()->getId(),
            'content' => $viewBuilder->buildContent($content),
        ];

        return $this->buildResponse($data, self::SERIALIZE_FULL);
    }
public function createContainerAction ( Request $ request ) { $ content = $ this -> findContentByRequest ( $ request ) ; $ type = $ request -> request -> get ( 'type' , null ) ; try { $ container = $ this -> getEditor ( ) -> createDefaultContainer ( $ type , [ ] , $ content ) ; } catch ( EditorExceptionInterface $ e ) { return $ this -> handleException ( $ e ) ; } $ this -> validate ( $ content ) ; $ this -> persist ( $ content ) ; $ viewBuilder = $ this -> getViewBuilder ( ) ; $ data = [ 'created' => $ viewBuilder -> buildContainer ( $ container ) -> getAttributes ( ) -> getId ( ) , 'content' => $ viewBuilder -> buildContent ( $ content ) , ] ; return $ this -> buildResponse ( $ data , self :: SERIALIZE_FULL ) ; }
Create and append a new container to the content.

@param Request $request

@return \Symfony\Component\HttpFoundation\Response
Create and append a new container to the content .