public function postAction($type, Request $request)
    {
        $classname = AbstractClassContent::getClassnameByContentType($type);
        $content = new $classname();
        $this->granted('CREATE', $content);

        $this->getEntityManager()->persist($content);
        $content->setDraft($this->getClassContentManager()->getDraft($content, true));

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

        $data = $request->request->all();
        if (0 < count($data)) {
            $data = array_merge($data, [
                'type' => $type,
                'uid'  => $content->getUid(),
            ]);

            $this->updateClassContent($type, $data['uid'], $data);
            $this->getEntityManager()->flush();
        }

        return $this->createJsonResponse(null, 201, [
            'BB-RESOURCE-UID' => $content->getUid(),
            'Location'        => $this->getApplication()->getRouting()->getUrlByRouteName(
                'bb.rest.classcontent.get',
                [
                    'version' => $request->attributes->get('version'),
                    'type'    => $type,
                    'uid'     => $content->getUid(),
                ],
                '',
                false
            ),
        ]);
    }
public function postAction($type, Request $request)
    {
        $classname = AbstractClassContent::getClassnameByContentType($type);
        $content = new $classname();
        $this->granted('CREATE', $content);

        $this->getEntityManager()->persist($content);
        $content->setDraft($this->getClassContentManager()->getDraft($content, true));

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

        $data = $request->request->all();
        if (0 < count($data)) {
            $data = array_merge($data, [
                'type' => $type,
                'uid'  => $content->getUid(),
            ]);

            $this->updateClassContent($type, $data['uid'], $data);
            $this->getEntityManager()->flush();
        }

        return $this->createJsonResponse(null, 201, [
            'BB-RESOURCE-UID' => $content->getUid(),
            'Location'        => $this->getApplication()->getRouting()->getUrlByRouteName(
                'bb.rest.classcontent.get',
                [
                    'version' => $request->attributes->get('version'),
                    'type'    => $type,
                    'uid'     => $content->getUid(),
                ],
                '',
                false
            ),
        ]);
    }
public function postAction ( $ type , Request $ request ) { $ classname = AbstractClassContent :: getClassnameByContentType ( $ type ) ; $ content = new $ classname ( ) ; $ this -> granted ( 'CREATE' , $ content ) ; $ this -> getEntityManager ( ) -> persist ( $ content ) ; $ content -> setDraft ( $ this -> getClassContentManager ( ) -> getDraft ( $ content , true ) ) ; $ this -> getEntityManager ( ) -> flush ( ) ; $ data = $ request -> request -> all ( ) ; if ( 0 < count ( $ data ) ) { $ data = array_merge ( $ data , [ 'type' => $ type , 'uid' => $ content -> getUid ( ) , ] ) ; $ this -> updateClassContent ( $ type , $ data [ 'uid' ] , $ data ) ; $ this -> getEntityManager ( ) -> flush ( ) ; } return $ this -> createJsonResponse ( null , 201 , [ 'BB-RESOURCE-UID' => $ content -> getUid ( ) , 'Location' => $ this -> getApplication ( ) -> getRouting ( ) -> getUrlByRouteName ( 'bb.rest.classcontent.get' , [ 'version' => $ request -> attributes -> get ( 'version' ) , 'type' => $ type , 'uid' => $ content -> getUid ( ) , ] , '' , false ) , ] ) ; }
Creates classcontent according to provided type.

@param string  $type
@param Request $request

@return Symfony\Component\HttpFoundation\Response

@Rest\Security("is_fully_authenticated() & has_role('ROLE_API_USER')")
Creates classcontent according to provided type .