In Zend Framework, is it possible to add functionality to the $this object used within the controller?
I’m trying to create an API, defined by class files stored in a seperate folder. So would love to be able to go:
$userDetails = $this->api->user()->getDetails();
Is this possible?
This is just a reference to the object instance so you just need to add methods and properties to the class in question. For example:
Of course this probably isnt the best way to go about it. I would probably put the api as a bootstrap resource and in that case youd do: