src/Controller/Api/PageController.php
protected function handleWritePage($request, $id = null)
    {
        $page = $id ? $this->getPage($id) : null;

        $form = $this->formFactory->createNamed(null, 'sonata_page_api_form_page', $page, [
            'csrf_protection' => false,
        ]);

        $form->handleRequest($request);

        if ($form->isValid()) {
            $page = $form->getData();
            $this->pageManager->save($page);

            return $this->serializeContext($page, ['sonata_api_read']);
        }

        return $form;
    }
protected function handleWritePage($request, $id = null)
    {
        $page = $id ? $this->getPage($id) : null;

        $form = $this->formFactory->createNamed(null, 'sonata_page_api_form_page', $page, [
            'csrf_protection' => false,
        ]);

        $form->handleRequest($request);

        if ($form->isValid()) {
            $page = $form->getData();
            $this->pageManager->save($page);

            return $this->serializeContext($page, ['sonata_api_read']);
        }

        return $form;
    }
protected function handleWritePage ( $ request , $ id = null ) { $ page = $ id ? $ this -> getPage ( $ id ) : null ; $ form = $ this -> formFactory -> createNamed ( null , 'sonata_page_api_form_page' , $ page , [ 'csrf_protection' => false , ] ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isValid ( ) ) { $ page = $ form -> getData ( ) ; $ this -> pageManager -> save ( $ page ) ; return $ this -> serializeContext ( $ page , [ 'sonata_api_read' ] ) ; } return $ form ; }
Write a page, this method is used by both POST and PUT action methods.

@param Request  $request Symfony request
@param int|null $id      A page identifier

@return FormInterface
Write a page this method is used by both POST and PUT action methods .