Is there anyway that I can get the request params directly from the model in zend framework? I need it for a constructor, so it doesn’t actually need contact with the database.
In a controller it’s easy to get the request… Something like $this->getRequest()->getParam('id'); but in a model that won’t work obviously. I just need to get an instance of the controller, and then I can call the getRequest()->getParam('id') methods.
Is there anyway that I can get the request params directly from the model
Share
Yes there is, but you are doing it wrong.
For the purposes of answering the question this is how you do it….(but don’t). You should pass the param to your model, rather than getting the param.
How to get the Request from Anywhere
But how you should be doing it (Assuming within controller context)