I created the following cookie in the controller Location:
$cookie = new \Zend\Http\Header\SetCookie('localidade_id', $localidade->getIdentificador(), time() + 3600);
However, when trying to access it in the controller Contact:
$getcookie = $request->getCookie();
$getcookie->offsetGet('localidade_id');
return is NULL. But if access is done in the locality controller, I have a valid value.
This is the first time I use cookies with ZF2, so I do not know if there is anything wrong. If anyone can help me.