ZF-7200: implement __get for Zend_Application_Bootstrap_BootstrapAbstract
Description
Zend_Application_Bootstrap_BootstrapAbstract should make use of __get magic to proxy to getResource().
This would allow codes like (exemple) :
class MyPlugin_FrontController extends Zend_Application_Resource_Frontcontroller
{
public function init()
{
$acl = $this->getBootstrap()->acl;
// ... ...
}
}
Comments
Posted by Matthew Weier O'Phinney (matthew) on 2009-07-06T05:30:40.000+0000
Feel free to add this in trunk -- you already have commit access. The idea makes sense.
I'd also encourage adding __isset support that proxies to hasResource().
Posted by julien PAULI (doctorrock83) on 2009-07-06T10:07:03.000+0000
Ok thats mine, as soon as I have a minute to write the improvement ;-) I auto assign it.
Posted by Dolf Schimmel (Freeaqingme) (freak) on 2009-07-06T10:09:33.000+0000
Wait, what would be the advantage?
Posted by Matthew Weier O'Phinney (matthew) on 2009-07-06T10:50:17.000+0000
Dolf -- the advantage would primarily be that access to the various resources would be simpler; there would be no reason to call "getResource()" or "hasResource()" -- just use simply isset() and property retrieval. The bootstrap doesn't have any public properties currently anyways.
Posted by julien PAULI (doctorrock83) on 2009-07-06T11:47:03.000+0000
Yeah, that's it. __magic methods are very nice as they usually make an API look simpler and "user-friendly"er.
I just wanted Zend review to know if nothing was planned in using more __magic methods in the future in that class. Apparently not, so I'll patch that. I can see no use case about __set() so I wont write one.
Posted by julien PAULI (doctorrock83) on 2009-07-07T10:02:45.000+0000
Added to classes in SVN at r16555