Answer the question
In order to leave comments, you need to log in
Why do some hints in the ZF2 controller not work and how best to deal with this?
In the controller method, we enter $this->getRequest()->
and are not visible in the list of hints, for example, the getHeader method.
To see hints, you have to write like this:
namespace Application\Controller;
use Zend\Mvc\Controller\AbstractActionController;
use Zend\Http\PhpEnvironment\Response as HttpResponse;
use Zend\Http\Request as HttpRequest;
/**
* @method HttpRequest getRequest() Get request object
* @method HttpResponse getResponse() Get response object
*/
class TestController extends AbstractActionController
{
public function testAction()
{
$this->getRequest()->getHeader('referer'); // подсказки работают
}
}
Answer the question
In order to leave comments, you need to log in
They have type \Zend\Stdlib\RequestInterface, you have \Zend\Http\Request.
I would call it a design error on their part: the interface should have been extended.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question