Initial Problem
protected function _initMail()
{
$this->bootstrap(‘mail’);
}
in my Bootstrap.php
Fails with a:
Uncaught exception ‘Zend_Application_Bootstrap_Exception’ with message
‘Circular resource dependency detected’
Solution: Don’t call a Ressource within its own bootstrap method (e.g. mail => _initMail).
The Question: How to simplify setting up resources in the config to have less config code in the controller?
So far I get $bootstrap->getResource(‘mail’) to return something that looks like a bit like what I tried to achieve.
It returns an instance of Zend_Mail_Transport_Sendmail (nearly emtpy, without any attributes set).
The goal would be to have Zend_Mail::’s static properties to be set to the values defined in the config
This seems to be a general question about how to ACTUALLY bootstrap Zend resources, since no where is properly documentad how to bootstrap certain resources.
I simply followed the standard (and bootstrap view example).
My application.ini seems to be configured to handle the information needed for Mail configuration:
resources.view[] =
autoloaderNamespaces[] = "ZSC_"
wall.upload = APPLICATION_PATH "/uploads"
wall.uploadTemporary = APPLICATION_PATH "/temp"
resources.mail.transport.type = sendmail
;resources.mail.transport.host = "smtp.udag.de"
;resources.mail.transport.auth = login
;resources.mail.transport.username = nix
;resources.mail.transport.password = nix
resources.mail.transport.register = true ; True by default
resources.mail.defaultFrom.email = "support@conexco.de"
resources.mail.defaultFrom.name = "Mr Conexco Support"
Actually,
$this->bootstrap('mail');is calling the_initMail()method. So, you have a method calling itself infinitely, that’s why you are getting the “Circular resource dependency” error message.The calls to the
_initXXX()methods are already handled by$application->bootstrap()in yourindex.phpfile, you only need to use them explicitly if you have dependencies between methods (i.e., mail depending on something else).Hope that helps,