src/Graviton/FileBundle/Controller/FileController.php
public function postAction(Request $request)
    {
        $file = new File();
        $request = $this->requestManager->updateFileRequest($request);

        if ($formData = $request->get('metadata')) {
            $file = $this->restUtils->validateRequest($formData, $this->getModel());
        }

        /** @var FileModel $model */
        $model = $this->getModel();
        $file = $this->fileManager->handleSaveRequest($file, $request, $model);

        // Set status code and content
        $response = $this->getResponse();
        $response->setStatusCode(Response::HTTP_CREATED);
        $response->headers->set(
            'Location',
            $this->getRouter()->generate('gravitondyn.file.rest.file.get', array('id' => $file->getId()))
        );
        return $response;
    }
public function postAction(Request $request)
    {
        $file = new File();
        $request = $this->requestManager->updateFileRequest($request);

        if ($formData = $request->get('metadata')) {
            $file = $this->restUtils->validateRequest($formData, $this->getModel());
        }

        /** @var FileModel $model */
        $model = $this->getModel();
        $file = $this->fileManager->handleSaveRequest($file, $request, $model);

        // Set status code and content
        $response = $this->getResponse();
        $response->setStatusCode(Response::HTTP_CREATED);
        $response->headers->set(
            'Location',
            $this->getRouter()->generate('gravitondyn.file.rest.file.get', array('id' => $file->getId()))
        );
        return $response;
    }
public function postAction ( Request $ request ) { $ file = new File ( ) ; $ request = $ this -> requestManager -> updateFileRequest ( $ request ) ; if ( $ formData = $ request -> get ( 'metadata' ) ) { $ file = $ this -> restUtils -> validateRequest ( $ formData , $ this -> getModel ( ) ) ; } /** @var FileModel $model */ $ model = $ this -> getModel ( ) ; $ file = $ this -> fileManager -> handleSaveRequest ( $ file , $ request , $ model ) ; // Set status code and content $ response = $ this -> getResponse ( ) ; $ response -> setStatusCode ( Response :: HTTP_CREATED ) ; $ response -> headers -> set ( 'Location' , $ this -> getRouter ( ) -> generate ( 'gravitondyn.file.rest.file.get' , array ( 'id' => $ file -> getId ( ) ) ) ) ; return $ response ; }
Writes a new Entry to the database
Can accept either direct Post data or Form upload

@param Request $request Current http request

@return Response $response Result of action with data (if successful)
Writes a new Entry to the database Can accept either direct Post data or Form upload