public function addElement(Request $request, $file_id)
    {
        $ret = ['success' => false, 'message' => '', 'result'  => []];

        //Mandatory parameter
        if (null === $request->request->get('bas_id')) {
            $ret['message'] = $this->app->trans('You must give a destination collection');

            return $this->app->json($ret);
        }

        //Optional parameter
        $keepAttributes = !!$request->request->get('keep_attributes', false);
        $attributesToKeep = $request->request->get('attributes', []);

        /** @var LazaretManipulator $lazaretManipulator */
        $lazaretManipulator = $this->app['manipulator.lazaret'];

        $ret = $lazaretManipulator->add($file_id, $keepAttributes, $attributesToKeep);

        return $this->app->json($ret);
    }
public function addElement(Request $request, $file_id)
    {
        $ret = ['success' => false, 'message' => '', 'result'  => []];

        //Mandatory parameter
        if (null === $request->request->get('bas_id')) {
            $ret['message'] = $this->app->trans('You must give a destination collection');

            return $this->app->json($ret);
        }

        //Optional parameter
        $keepAttributes = !!$request->request->get('keep_attributes', false);
        $attributesToKeep = $request->request->get('attributes', []);

        /** @var LazaretManipulator $lazaretManipulator */
        $lazaretManipulator = $this->app['manipulator.lazaret'];

        $ret = $lazaretManipulator->add($file_id, $keepAttributes, $attributesToKeep);

        return $this->app->json($ret);
    }
public function addElement ( Request $ request , $ file_id ) { $ ret = [ 'success' => false , 'message' => '' , 'result' => [ ] ] ; //Mandatory parameter if ( null === $ request -> request -> get ( 'bas_id' ) ) { $ ret [ 'message' ] = $ this -> app -> trans ( 'You must give a destination collection' ) ; return $ this -> app -> json ( $ ret ) ; } //Optional parameter $ keepAttributes = ! ! $ request -> request -> get ( 'keep_attributes' , false ) ; $ attributesToKeep = $ request -> request -> get ( 'attributes' , [ ] ) ; /** @var LazaretManipulator $lazaretManipulator */ $ lazaretManipulator = $ this -> app [ 'manipulator.lazaret' ] ; $ ret = $ lazaretManipulator -> add ( $ file_id , $ keepAttributes , $ attributesToKeep ) ; return $ this -> app -> json ( $ ret ) ; }
Add an element to phraseanet

@param Request     $request The current request
@param int         $file_id A lazaret element id

parameters   : 'bas_id'            int     (mandatory) : The id of the destination collection
'keep_attributes'   boolean (optional)  : Keep all attributes attached to the lazaret element
'attributes'        array   (optional)  : Attributes id's to attach to the lazaret element

@return Response
Add an element to phraseanet