@@ -61,37 +61,39 @@ public function createAction($ouuid, ContentType $contentType, Request $request)
6161 /**
6262 * @Route("/api/{name}/finalize/{id}", defaults={"_format": "json"})
6363 * @ParamConverter("contentType", options={"mapping": {"name": "name", "deleted": 0, "active": 1}})
64- * @Method({"GET "})
64+ * @Method({"POST "})
6565 */
6666 public function finalizeAction ($ id , ContentType $ contentType , Request $ request ) {
6767
6868 if (!$ contentType ->getEnvironment ()->getManaged ()){
6969 throw new BadRequestHttpException ('You can not create content for a managed content type ' );
7070 }
7171
72+ $ out = [
73+ 'success ' => 'false ' ,
74+ ];
7275 try {
7376 $ revision = $ this ->dataService ()->getRevisionById ($ id , $ contentType );
7477 $ newRevision = $ this ->dataService ()->finalizeDraft ($ revision );
75- $ isFinalize = !$ newRevision ->getDraft ();
78+ $ out ['success ' ] = !$ newRevision ->getDraft ();
79+ $ out ['uuid ' ] = $ newRevision ->getOuuid ();
7680
7781 } catch (\Exception $ e ) {
7882 if (($ e instanceof NotFoundHttpException) OR ($ e instanceof DataStateException)) {
7983 $ this ->addFlash ('error ' , $ e ->getMessage ());
8084 } else {
8185 $ this ->addFlash ('error ' , 'The revision ' . $ id . ' can not be finalized ' );
8286 }
83- $ isFinalize = false ;
87+ $ out [ ' success ' ] = false ;
8488
8589 }
86- return $ this ->render ( 'EMSCoreBundle:ajax:notification.json.twig ' , [
87- 'success ' => $ isFinalize ,
88- ]);
90+ return $ this ->render ( 'EMSCoreBundle:ajax:notification.json.twig ' , $ out );
8991 }
9092
9193 /**
9294 * @Route("/api/{name}/discard/{id}", defaults={"_format": "json"})
9395 * @ParamConverter("contentType", options={"mapping": {"name": "name", "deleted": 0, "active": 1}})
94- * @Method({"GET "})
96+ * @Method({"POST "})
9597 */
9698 public function discardAction ($ id , ContentType $ contentType , Request $ request ) {
9799
0 commit comments