Issues

ZF-7200: implement __get for Zend_Application_Bootstrap_BootstrapAbstract

Issue Type: Improvement Created: 2009-07-06T03:39:18.000+0000 Last Updated: 2009-07-31T20:49:25.000+0000 Status: Resolved Fix version(s): - 1.9.0 (31/Jul/09)

Reporter: julien PAULI (doctorrock83) Assignee: julien PAULI (doctorrock83) Tags: - Zend_Application

Related issues: Attachments:

Description

Zend_Application_Bootstrap_BootstrapAbstract should make use of __get magic to proxy to getResource().

This would allow codes like (exemple) :

<pre class="highlight">
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

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts