original_string: public function createAction(Request $request)
      {
          $templateRepository = $this->get('phlexible_media_template.template_manager');
  
          $type = $request->get('type');
          $key = $request->get('key');
  
          switch ($type) {
              case 'image':
                  $template = new ImageTemplate();
                  $template->setCache(false);
                  break;
              case 'video':
                  $template = new VideoTemplate();
                  $template->setCache(true);
                  break;
              case 'audio':
                  $template = new AudioTemplate();
                  $template->setCache(true);
                  break;
              default:
                  throw new InvalidArgumentException("Unknown template type $type");
          }
  
          $template->setKey($key);
  
          $templateRepository->updateTemplate($template);
  
          return new ResultResponse(true, 'New "'.$type.'" template "'.$key.'" created.');
      }
code: public function createAction(Request $request)
      {
          $templateRepository = $this->get('phlexible_media_template.template_manager');
  
          $type = $request->get('type');
          $key = $request->get('key');
  
          switch ($type) {
              case 'image':
                  $template = new ImageTemplate();
                  $template->setCache(false);
                  break;
              case 'video':
                  $template = new VideoTemplate();
                  $template->setCache(true);
                  break;
              case 'audio':
                  $template = new AudioTemplate();
                  $template->setCache(true);
                  break;
              default:
                  throw new InvalidArgumentException("Unknown template type $type");
          }
  
          $template->setKey($key);
  
          $templateRepository->updateTemplate($template);
  
          return new ResultResponse(true, 'New "'.$type.'" template "'.$key.'" created.');
      }
code_tokens: public function createAction ( Request $ request ) { $ templateRepository = $ this -> get ( 'phlexible_media_template.template_manager' ) ; $ type = $ request -> get ( 'type' ) ; $ key = $ request -> get ( 'key' ) ; switch ( $ type ) { case 'image' : $ template = new ImageTemplate ( ) ; $ template -> setCache ( false ) ; break ; case 'video' : $ template = new VideoTemplate ( ) ; $ template -> setCache ( true ) ; break ; case 'audio' : $ template = new AudioTemplate ( ) ; $ template -> setCache ( true ) ; break ; default : throw new InvalidArgumentException ( "Unknown template type $type" ) ; } $ template -> setKey ( $ key ) ; $ templateRepository -> updateTemplate ( $ template ) ; return new ResultResponse ( true , 'New "' . $ type . '" template "' . $ key . '" created.' ) ; }
docstring: Create mediatemplate.
  
  @param Request $request
  
  @throws \InvalidArgumentException
  
  @return ResultResponse
  @Route("/create", name="mediatemplates_templates_create")
docstring_tokens: Create mediatemplate .