public function putDraftCollectionAction(Request $request)
    {
        $result = [];
        foreach ($request->request->all() as $data) {
            if (!isset($data['type']) || !isset($data['uid'])) {
                throw new BadRequestHttpException("type and/or uid is missing.");
            }

            try {
                $content = $this->updateClassContentDraft($data['type'], $data['uid'], $data);
                $result[] = [
                    'uid'        => $content->getUid(),
                    'type'       => $content->getContentType(),
                    'statusCode' => 200,
                    'message'    => 'OK',
                ];
            } catch (AccessDeniedException $e) {
                $result[] = [
                    'uid'        => $data['uid'],
                    'type'       => $data['type'],
                    'statusCode' => 401,
                    'message'    => $e->getMessage(),
                ];
            } catch (\Exception $e) {
                $result[] = [
                    'uid'        => $data['uid'],
                    'type'       => $data['type'],
                    'statusCode' => 500,
                    'message'    => $e->getMessage(),
                ];
            }
        }

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

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

            try {
                $content = $this->updateClassContentDraft($data['type'], $data['uid'], $data);
                $result[] = [
                    'uid'        => $content->getUid(),
                    'type'       => $content->getContentType(),
                    'statusCode' => 200,
                    'message'    => 'OK',
                ];
            } catch (AccessDeniedException $e) {
                $result[] = [
                    'uid'        => $data['uid'],
                    'type'       => $data['type'],
                    'statusCode' => 401,
                    'message'    => $e->getMessage(),
                ];
            } catch (\Exception $e) {
                $result[] = [
                    'uid'        => $data['uid'],
                    'type'       => $data['type'],
                    'statusCode' => 500,
                    'message'    => $e->getMessage(),
                ];
            }
        }

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

        return $this->createJsonResponse($result);
    }
public function putDraftCollectionAction ( Request $ request ) { $ result = [ ] ; foreach ( $ request -> request -> all ( ) as $ data ) { if ( ! isset ( $ data [ 'type' ] ) || ! isset ( $ data [ 'uid' ] ) ) { throw new BadRequestHttpException ( "type and/or uid is missing." ) ; } try { $ content = $ this -> updateClassContentDraft ( $ data [ 'type' ] , $ data [ 'uid' ] , $ data ) ; $ result [ ] = [ 'uid' => $ content -> getUid ( ) , 'type' => $ content -> getContentType ( ) , 'statusCode' => 200 , 'message' => 'OK' , ] ; } catch ( AccessDeniedException $ e ) { $ result [ ] = [ 'uid' => $ data [ 'uid' ] , 'type' => $ data [ 'type' ] , 'statusCode' => 401 , 'message' => $ e -> getMessage ( ) , ] ; } catch ( \ Exception $ e ) { $ result [ ] = [ 'uid' => $ data [ 'uid' ] , 'type' => $ data [ 'type' ] , 'statusCode' => 500 , 'message' => $ e -> getMessage ( ) , ] ; } } $ this -> getEntityManager ( ) -> flush ( ) ; return $ this -> createJsonResponse ( $ result ) ; }
Updates collection of classcontents' drafts.

@param Request $request

@return Symfony\Component\HttpFoundation\JsonResponse

@Rest\Security("is_fully_authenticated() & has_role('ROLE_API_USER')")
Updates collection of classcontents drafts .