CookieService createCookie . , , cookie.
protected $translator;
protected $cookieService;
public function __construct($translator, CookieService $cookie)
{
$this->translator = $translator;
$this->cookieService = $cookieService;
}
public function changeLanguageAction()
{
$language = $this->params()->fromRoute('lang', 'en');
$this->cookieService->createCookie('xuage', $language, '/');
$this->redirect()->toRoute('home');
}
cookie . , CookieService:
$this->getResponse()->getHeaders()->addHeader($this->cookie);