public function patchAction($id, Request $request)
    {
        $bundle = $this->getBundleById($id);

        $this->granted('EDIT', $bundle);
        $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($bundle, array(
            'category'        => array('replace'),
            'config_per_site' => array('replace'),
            'enable'          => array('replace'),
        ));

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

        $this->getApplication()->getContainer()->get('config.persistor')->persist(
            $bundle->getConfig(),
            null !== $bundle->getConfig()->getProperty('config_per_site')
                ? $bundle->getConfig()->getProperty('config_per_site')
                : false
        );

        return $this->createJsonResponse(null, 204);
    }
public function patchAction($id, Request $request)
    {
        $bundle = $this->getBundleById($id);

        $this->granted('EDIT', $bundle);
        $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($bundle, array(
            'category'        => array('replace'),
            'config_per_site' => array('replace'),
            'enable'          => array('replace'),
        ));

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

        $this->getApplication()->getContainer()->get('config.persistor')->persist(
            $bundle->getConfig(),
            null !== $bundle->getConfig()->getProperty('config_per_site')
                ? $bundle->getConfig()->getProperty('config_per_site')
                : false
        );

        return $this->createJsonResponse(null, 204);
    }
public function patchAction ( $ id , Request $ request ) { $ bundle = $ this -> getBundleById ( $ id ) ; $ this -> granted ( 'EDIT' , $ bundle ) ; $ 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 ( $ bundle , array ( 'category' => array ( 'replace' ) , 'config_per_site' => array ( 'replace' ) , 'enable' => array ( 'replace' ) , ) ) ; try { $ entity_patcher -> patch ( $ bundle , $ operations ) ; } catch ( UnauthorizedPatchOperationException $ e ) { throw new BadRequestHttpException ( 'Invalid patch operation: ' . $ e -> getMessage ( ) ) ; } $ this -> getApplication ( ) -> getContainer ( ) -> get ( 'config.persistor' ) -> persist ( $ bundle -> getConfig ( ) , null !== $ bundle -> getConfig ( ) -> getProperty ( 'config_per_site' ) ? $ bundle -> getConfig ( ) -> getProperty ( 'config_per_site' ) : false ) ; return $ this -> createJsonResponse ( null , 204 ) ; }
Patch the bundle.

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

@param string $id the id of the bundle we are looking for

@Rest\Security("is_fully_authenticated() & has_role('ROLE_API_USER')")
Patch the bundle .