public function putCollectionAction(Request $request)
    {
        $result = [];
        foreach ($request->request->all() as $data) {
            if (!isset($data['uid'])) {
                throw new BadRequestHttpException('uid is missing.');
            }

            try {
                $page = $this->getEntityManager()->getRepository('BackBee\NestedNode\Page')->find($data['uid']);

                $this->granted('EDIT', $page);
                if (isset($data['state'])) {
                    $this->granted('PUBLISH', $page);
                }
                $this->updatePage($page, $data);

                $result[] = [
                    'uid'        => $page->getUid(),
                    'statusCode' => 200,
                    'message'    => 'OK',
                ];
            } catch (NotModifiedException $e) {
                $result[] = [
                    'uid'        => $data['uid'],
                    'statusCode' => 304,
                    'message'    => $e->getMessage(),
                ];
            } catch (AccessDeniedException $e) {
                $result[] = [
                    'uid'        => $data['uid'],
                    'statusCode' => 401,
                    'message'    => $e->getMessage(),
                ];
            } catch (\Exception $e) {
                if ($e instanceof BadRequestHttpException || $e instanceof InsufficientAuthenticationException) {
                    $result[] = [
                        'uid'        => $data['uid'],
                        'statusCode' => 403,
                        'message'    => $e->getMessage(),
                    ];
                } else {
                    $result[] = [
                        'uid'        => $data['uid'],
                        'statusCode' => 500,
                        'message'    => $e->getMessage(),
                    ];
                }
            }
        }

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

        return $this->createJsonResponse($result);
    }
public function putCollectionAction(Request $request)
    {
        $result = [];
        foreach ($request->request->all() as $data) {
            if (!isset($data['uid'])) {
                throw new BadRequestHttpException('uid is missing.');
            }

            try {
                $page = $this->getEntityManager()->getRepository('BackBee\NestedNode\Page')->find($data['uid']);

                $this->granted('EDIT', $page);
                if (isset($data['state'])) {
                    $this->granted('PUBLISH', $page);
                }
                $this->updatePage($page, $data);

                $result[] = [
                    'uid'        => $page->getUid(),
                    'statusCode' => 200,
                    'message'    => 'OK',
                ];
            } catch (NotModifiedException $e) {
                $result[] = [
                    'uid'        => $data['uid'],
                    'statusCode' => 304,
                    'message'    => $e->getMessage(),
                ];
            } catch (AccessDeniedException $e) {
                $result[] = [
                    'uid'        => $data['uid'],
                    'statusCode' => 401,
                    'message'    => $e->getMessage(),
                ];
            } catch (\Exception $e) {
                if ($e instanceof BadRequestHttpException || $e instanceof InsufficientAuthenticationException) {
                    $result[] = [
                        'uid'        => $data['uid'],
                        'statusCode' => 403,
                        'message'    => $e->getMessage(),
                    ];
                } else {
                    $result[] = [
                        'uid'        => $data['uid'],
                        'statusCode' => 500,
                        'message'    => $e->getMessage(),
                    ];
                }
            }
        }

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

        return $this->createJsonResponse($result);
    }
public function putCollectionAction ( Request $ request ) { $ result = [ ] ; foreach ( $ request -> request -> all ( ) as $ data ) { if ( ! isset ( $ data [ 'uid' ] ) ) { throw new BadRequestHttpException ( 'uid is missing.' ) ; } try { $ page = $ this -> getEntityManager ( ) -> getRepository ( 'BackBee\NestedNode\Page' ) -> find ( $ data [ 'uid' ] ) ; $ this -> granted ( 'EDIT' , $ page ) ; if ( isset ( $ data [ 'state' ] ) ) { $ this -> granted ( 'PUBLISH' , $ page ) ; } $ this -> updatePage ( $ page , $ data ) ; $ result [ ] = [ 'uid' => $ page -> getUid ( ) , 'statusCode' => 200 , 'message' => 'OK' , ] ; } catch ( NotModifiedException $ e ) { $ result [ ] = [ 'uid' => $ data [ 'uid' ] , 'statusCode' => 304 , 'message' => $ e -> getMessage ( ) , ] ; } catch ( AccessDeniedException $ e ) { $ result [ ] = [ 'uid' => $ data [ 'uid' ] , 'statusCode' => 401 , 'message' => $ e -> getMessage ( ) , ] ; } catch ( \ Exception $ e ) { if ( $ e instanceof BadRequestHttpException || $ e instanceof InsufficientAuthenticationException ) { $ result [ ] = [ 'uid' => $ data [ 'uid' ] , 'statusCode' => 403 , 'message' => $ e -> getMessage ( ) , ] ; } else { $ result [ ] = [ 'uid' => $ data [ 'uid' ] , 'statusCode' => 500 , 'message' => $ e -> getMessage ( ) , ] ; } } } $ this -> getEntityManager ( ) -> flush ( ) ; return $ this -> createJsonResponse ( $ result ) ; }
Update page collecton.

@return \Symfony\Component\HttpFoundation\JsonResponse

@Rest\Security("is_fully_authenticated() & has_role('ROLE_API_USER')")
Update page collecton .