Sulu\Bundle\MediaBundle\Controller\FormatController::putAction PHP Method

putAction() public method

Edits a format resource.
public putAction ( integer $id, string $key, Request $request ) : Response
$id integer
$key string
$request Symfony\Component\HttpFoundation\Request
return Symfony\Component\HttpFoundation\Response
    public function putAction($id, $key, Request $request)
    {
        $options = $request->get('options', []);
        $locale = $this->getRequestParameter($request, 'locale', true);
        if (empty($options)) {
            $this->getFormatOptionsManager()->delete($id, $key);
        } else {
            $this->getFormatOptionsManager()->save($id, $key, $options);
        }
        $this->get('doctrine.orm.entity_manager')->flush();
        $formatOptions = $this->getFormatOptionsManager()->get($id, $key);
        $format = $this->getFormatManager()->getFormatDefinition($key, $locale, $formatOptions);
        return $this->handleView($this->view($format));
    }