copyLocale() public method

TODO: We currently need the content mapper to copy the locale, it should be removed, see https://github.com/sulu-io/sulu/issues/1998
public copyLocale ( string $uuid, integer $userId, string $srcLocale, string $destLocales ) : SnippetBridge
$uuid string
$userId integer
$srcLocale string
$destLocales string
return Sulu\Component\Content\Compat\Structure\SnippetBridge
Example #1
0
 /**
  * trigger a action for given snippet specified over get-action parameter.
  *
  * @Post("/snippets/{uuid}")
  *
  * @param string $uuid
  * @param Request $request
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function postTriggerAction($uuid, Request $request)
 {
     $view = null;
     $snippet = null;
     $this->initEnv($request);
     $action = $this->getRequestParameter($request, 'action', true);
     try {
         switch ($action) {
             case 'copy-locale':
                 $destLocale = $this->getRequestParameter($request, 'dest', true);
                 // call repository method
                 $snippet = $this->snippetRepository->copyLocale($uuid, $this->getUser()->getId(), $this->languageCode, explode(',', $destLocale));
                 break;
             default:
                 throw new RestException('Unrecognized action: ' . $action);
         }
         // prepare view
         $view = View::create($this->decorateSnippet($snippet->toArray(), $this->languageCode), $snippet !== null ? 200 : 204);
     } catch (RestException $exc) {
         $view = View::create($exc->toArray(), 400);
     }
     return $this->viewHandler->handle($view);
 }