public function patchAction(Page $page, Request $request)
    {
        $operations = $request->request->all();

        try {
            (new OperationSyntaxValidator())->validate($operations);
        } catch (InvalidOperationSyntaxException $e) {
            throw new BadRequestHttpException('operation invalid syntax: '.$e->getMessage());
        }

        $entity_patcher = new EntityPatcher(new RightManager($this->getSerializer()->getMetadataFactory()));
        $entity_patcher->getRightManager()->addAuthorizationMapping($page, array(
            'publishing' => array('replace'),
            'archiving' => array('replace')
        ));

        $this->patchStateOperation($page, $operations);
        $this->patchSiblingAndParentOperation($page, $operations);

        try {
            $entity_patcher->patch($page, $operations);
        } catch (UnauthorizedPatchOperationException $e) {
            throw new BadRequestHttpException('Invalid patch operation: '.$e->getMessage());
        }

        if (true === $page->isOnline(true)) {
            $this->granted('PUBLISH', $page);
        }

        $this->getEntityManager()->flush();

        return $this->createJsonResponse(null, 204);
    }
public function patchAction(Page $page, Request $request)
    {
        $operations = $request->request->all();

        try {
            (new OperationSyntaxValidator())->validate($operations);
        } catch (InvalidOperationSyntaxException $e) {
            throw new BadRequestHttpException('operation invalid syntax: '.$e->getMessage());
        }

        $entity_patcher = new EntityPatcher(new RightManager($this->getSerializer()->getMetadataFactory()));
        $entity_patcher->getRightManager()->addAuthorizationMapping($page, array(
            'publishing' => array('replace'),
            'archiving' => array('replace')
        ));

        $this->patchStateOperation($page, $operations);
        $this->patchSiblingAndParentOperation($page, $operations);

        try {
            $entity_patcher->patch($page, $operations);
        } catch (UnauthorizedPatchOperationException $e) {
            throw new BadRequestHttpException('Invalid patch operation: '.$e->getMessage());
        }

        if (true === $page->isOnline(true)) {
            $this->granted('PUBLISH', $page);
        }

        $this->getEntityManager()->flush();

        return $this->createJsonResponse(null, 204);
    }
public function patchAction ( Page $ page , Request $ request ) { $ operations = $ request -> request -> all ( ) ; try { ( new OperationSyntaxValidator ( ) ) -> validate ( $ operations ) ; } catch ( InvalidOperationSyntaxException $ e ) { throw new BadRequestHttpException ( 'operation invalid syntax: ' . $ e -> getMessage ( ) ) ; } $ entity_patcher = new EntityPatcher ( new RightManager ( $ this -> getSerializer ( ) -> getMetadataFactory ( ) ) ) ; $ entity_patcher -> getRightManager ( ) -> addAuthorizationMapping ( $ page , array ( 'publishing' => array ( 'replace' ) , 'archiving' => array ( 'replace' ) ) ) ; $ this -> patchStateOperation ( $ page , $ operations ) ; $ this -> patchSiblingAndParentOperation ( $ page , $ operations ) ; try { $ entity_patcher -> patch ( $ page , $ operations ) ; } catch ( UnauthorizedPatchOperationException $ e ) { throw new BadRequestHttpException ( 'Invalid patch operation: ' . $ e -> getMessage ( ) ) ; } if ( true === $ page -> isOnline ( true ) ) { $ this -> granted ( 'PUBLISH' , $ page ) ; } $ this -> getEntityManager ( ) -> flush ( ) ; return $ this -> createJsonResponse ( null , 204 ) ; }
Patch page.

@return \Symfony\Component\HttpFoundation\Response

@Rest\RequestParam(name="0", description="Patch operations", requirements={
@Assert\NotBlank(message="Request must contain at least one operation")
})

@Rest\ParamConverter(name="page", class="BackBee\NestedNode\Page")
@Rest\Security(expression="is_granted('EDIT', page)")
Patch page .