-- dmitrybelyakov <[email protected]> wrote
(on Tuesday, 13 April 2010, 05:39 AM -0800):
> 
> It’s should be me doing something wrong but i just can’t get my head around
> this. So if someone can help 
> me out i would be very greatful.
> 
> What i do is create a new application resource plugin resource following a
> Matthew’s guide to 
> http://weierophinney.net/matthew/archives/231-Creating-Re-Usable-Zend_Application-Resource-Plugins.html
> Creating Re-Usable Zend_Application Resource Plugins  with the following
> code:
> 
> class My_Application_Resource_Session 
>     extends Zend_Application_Resource_ResourceAbstract
> {
>     protected $_options = array();
>     
>     
>     public function __construct($options = null)
>     {
>         
>     }

Your problem is the above method -- you're overriding the constructor
defined in the abstract resource class. As a result, the bootstrap is
not being injected into your class.

You can solve it trivially with a call to
"parent::__construct($options);" somewhere within the constructor method
body.

>     public function init()
>     {
>         //Ensure the database resource was loaded
>         $bootstrap = $this->getBootstrap();
>         $bootstrap->bootstrap('View');
>         $view = $bootstrap->getResource('View'); 
>     }
> } // class ends here
> 
> 
> I then enable it in application.ini like this.
> 
> pluginPaths.My_Application_Resource = "My/Application/Resource" 
> resources.session.enabled = true
> 
> 
> Ok, everything is fine by now, the plugin gets loaded and executed. But as
> soon as it gets to bootstraping 
> a view resource I get an exception saying:
> 
> Fatal error: Call to a member function bootstrap() on a non-object in
> /../My/Application/Resource/Session.php
> 
> that is because $this->getBootstrap() returns NULL instead of bootstrap for
> some reason.
> 
> So what could probably be wrong here? Maybe i’m boostraping something wrong?
> Just no idea what’s the 
> problem here.
> 
> Dmitry.
> -- 
> View this message in context: 
> http://n4.nabble.com/Can-t-get-bootstrap-in-application-resource-plugin-tp1838417p1838417.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
> 

-- 
Matthew Weier O'Phinney
Project Lead            | [email protected]
Zend Framework          | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc

Reply via email to