Sulu\Bundle\MediaBundle\Controller\MediaController::moveEntity PHP Method

moveEntity() protected method

Move an entity to another collection.
protected moveEntity ( integer $id, Request $request ) : Response
$id integer
$request Symfony\Component\HttpFoundation\Request
return Symfony\Component\HttpFoundation\Response
    protected function moveEntity($id, Request $request)
    {
        try {
            $locale = $this->getRequestParameter($request, 'locale', true);
            $destination = $this->getRequestParameter($request, 'destination', true);
            $mediaManager = $this->getMediaManager();
            $media = $mediaManager->move($id, $locale, $destination);
            $view = $this->view($media, 200);
        } catch (MediaNotFoundException $e) {
            $view = $this->view($e->toArray(), 404);
        } catch (MediaException $e) {
            $view = $this->view($e->toArray(), 400);
        }
        return $this->handleView($view);
    }