jrsanfilippo (6) [Avatar] Offline
#1
I recreated the example in the book no problem. But my project is using Zend 1.8 (1.8.4) to be exact. The example is great. I am having issues with loading the helper in the bootstrap ...

// acl action helper
$acl = new Athena_Acl();
$aclHelper = new Athena_Controller_Action_Helper_Acl(null, array('acl'=>$acl));
Zend_Controller_Action_HelperBroker::addHelper($aclHelper);

I know that this has to go into the bootstrap but cannot figure out how to do it. I receive the following error ... so I know that the above needs to get into the bootstrap.

An error occurred
Application error
Exception information:

Message: Action Helper by name Acl not found
Stack trace:

#0 C:UsersjrsanfilippoDownloadsworkspaceathenaaclsandboxlibraryendControllerActionHelperBroker.php(292): Zend_Controller_Action_HelperBroker::_loadHelper('Acl')
#1 C:UsersjrsanfilippoDownloadsworkspaceathenaaclsandboxlibraryendControllerActionHelperBroker.php(33smilie: Zend_Controller_Action_HelperBroker->getHelper('acl')
#2 C:UsersjrsanfilippoDownloadsworkspaceathenaaclsandboxapplicationmodulesdefaultcontrollersIndexController.php(11): Zend_Controller_Action_HelperBroker->__get('acl')
#3 C:UsersjrsanfilippoDownloadsworkspaceathenaaclsandboxlibraryendControllerAction.php(132): IndexController->init()
#4 C:UsersjrsanfilippoDownloadsworkspaceathenaaclsandboxlibraryendControllerDispatcherStandard.php(261): Zend_Controller_Action->__construct(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http), Array)
#5 C:UsersjrsanfilippoDownloadsworkspaceathenaaclsandboxlibraryendControllerFront.php(945): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#6 C:UsersjrsanfilippoDownloadsworkspaceathenaaclsandboxlibraryendApplicationBootstrapBootstrap.php(77): Zend_Controller_Front->dispatch()
#7 C:UsersjrsanfilippoDownloadsworkspaceathenaaclsandboxlibraryendApplication.php(32smilie: Zend_Application_Bootstrap_Bootstrap->run()
#8 C:UsersjrsanfilippoDownloadsworkspaceathenaaclsandboxpublicindex.php(29): Zend_Application->run()
#9 {main}


My bootstrap currently looks like this ...

<?php <br /> // application/Bootstrap.php

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
/**
* Bootstrap autoloader for application resources
*
* @return Zend_Application_Module_Autoloader
*/
protected function _initAutoload()
{
$autoloader = new Zend_Application_Module_Autoloader(array(
'namespace' => 'Default',
'basePath' => dirname(__FILE__),
));
return $autoloader;
}

protected function _initSession(array $options = array())
{
$this->bootstrap('db');
$config = array('name' => 'session',
'primary' => 'session_id',
'modifiedColumn' => 'session_modified',
'dataColumn' => 'session_data',
'lifetimeColumn' => 'session_lifetime' );
Zend_Session::setSaveHandler(new Zend_Session_SaveHandler_DbTable($config));
Zend_Session::start();
}


What is the proper way to call the Acl helper in this 1.8.4 bootstrap?


Thanks in advance and thanks for the great book.
apprentice (77) [Avatar] Offline
#2
Re: Having issues with Acl's ... (Chapter 7 Acl example)
I want to know the answer to this question too! smilie
akrabat (479) [Avatar] Offline
#3
Re: Having issues with Acl's ... (Chapter 7 Acl example)
is Athena defined in application.ini?

[pre]
autoloadernamespaces[] = "Athena_"
[/pre]


Regards,

Rob...
jrsanfilippo (6) [Avatar] Offline
#4
Re: Having issues with Acl's ... (Chapter 7 Acl example)
Hi Rob,

Thanks for the response. The answer is no ... I do not have autoloadernamespaces[] = "Athena_" in the application.ini ... I will try that and let you know what happens.
jrsanfilippo (6) [Avatar] Offline
#5
Re: Having issues with Acl's ... (Chapter 7 Acl example)
Hi Rob,

The suggestion that you had was great. But I am still getting the following error:

Here is my bootstrap:

<?php <br /> // application/Bootstrap.php

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
/**
* Bootstrap autoloader for application resources
*
* @return Zend_Application_Module_Autoloader
*/
protected function _initAutoload()
{
$autoloader = new Zend_Application_Module_Autoloader(array(
'namespace' => 'Default',
'basePath' => dirname(__FILE__),
));
return $autoloader;
}

protected function _initSession(array $options = array())
{
$this->bootstrap('db');
$config = array('name' => 'session',
'primary' => 'session_id',
'modifiedColumn' => 'session_modified',
'dataColumn' => 'session_data',
'lifetimeColumn' => 'session_lifetime' );
Zend_Session::setSaveHandler(new Zend_Session_SaveHandler_DbTable($config));
Zend_Session::start();
}

protected function _initActionPlugins()
{
// ensure that config object is in registry
$this->_bootstrap('acl');
$config = new Zend_Config_Ini(APPLICATION_PATH . '/configs');

//var_dump($config);
//Zend_Controller_Action_HelperBroker::addPrefix('Athena_Controller_Action_Helper_');
//echo ('I got this far');
// acl action helper
$acl = new Athena_Acl();
$aclHelper = new Athena_Controller_Action_Helper_Acl(null, array('acl'=>$acl));
Zend_Controller_Action_HelperBroker::addHelper($aclHelper);
//echo ('I loaded my acl helper!');
}
}

An exception occured while bootstrapping the application.

Unable to resolve plugin "acl"; no corresponding plugin with that name
Stack Trace:

#0 C:UsersjrsanfilippoDownloadsworkspaceathenaaclsandbox2libraryendApplicationBootstrapBootstrapAbstract.php(314): Zend_Application_Bootstrap_BootstrapAbstract->getPluginResource('acl')
#1 C:UsersjrsanfilippoDownloadsworkspaceathenaaclsandbox2libraryendApplicationBootstrapBootstrapAbstract.php(673): Zend_Application_Bootstrap_BootstrapAbstract->hasPluginResource('acl')
#2 C:UsersjrsanfilippoDownloadsworkspaceathenaaclsandbox2libraryendApplicationBootstrapBootstrapAbstract.php(622): Zend_Application_Bootstrap_BootstrapAbstract->_executeResource('acl')
#3 C:UsersjrsanfilippoDownloadsworkspaceathenaaclsandbox2applicationBootstrap.php(35): Zend_Application_Bootstrap_BootstrapAbstract->_bootstrap('acl')
#4 C:UsersjrsanfilippoDownloadsworkspaceathenaaclsandbox2libraryendApplicationBootstrapBootstrapAbstract.php(662): Bootstrap->_initActionPlugins()
#5 C:UsersjrsanfilippoDownloadsworkspaceathenaaclsandbox2libraryendApplicationBootstrapBootstrapAbstract.php(615): Zend_Application_Bootstrap_BootstrapAbstract->_executeResource('actionplugins')
#6 C:UsersjrsanfilippoDownloadsworkspaceathenaaclsandbox2libraryendApplicationBootstrapBootstrapAbstract.php(579): Zend_Application_Bootstrap_BootstrapAbstract->_bootstrap(NULL)
#7 C:UsersjrsanfilippoDownloadsworkspaceathenaaclsandbox2libraryendApplication.php(335): Zend_Application_Bootstrap_BootstrapAbstract->bootstrap()
#8 C:UsersjrsanfilippoDownloadsworkspaceathenaaclsandbox2publicindex.php(29): Zend_Application->bootstrap()
#9 {main}

Message was edited by:
jrsanfilippo
akrabat (479) [Avatar] Offline
#6
Re: Having issues with Acl's ... (Chapter 7 Acl example)
What is the:

[pre]
$this->_bootstrap('acl');
[/pre]

line for?

That line is looking for an _initAcl() function or a resources.acl.xxx type line in your application.ini.

Regards,

Rob...
jrsanfilippo (6) [Avatar] Offline
#7
Re: Having issues with Acl's ... (Chapter 7 Acl example)
Hi Rob,

As in the Places example application, I have the $this->bootstrap('acl') because I have three lines in my applications.ini file ...

;Acl Groups
resources.acl.roles.guest = null
resources.acl.roles.member = guest
resources.acl.roles.admin = member

I assumed that the $this->bootstrap('acl') would read the roles above.

---------------------------------------
But okay ... I commmented out $this->bootstrap('acl') line.
I updated $config = new Zend_Config_Ini(APPLICATION_PATH . '/config);
to
$config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini');

---------------------------------------
In my /library/Acl.php file I updated
$config = Zend_Registry::get('config');
to
$config = Zend_Registry::get('configs/application.ini');

I am now getting the following error ...

An exception occured while bootstrapping the application.

No entry is registered for key 'configs/application.ini'
Stack Trace:

#0 C:UsersjrsanfilippoDownloadsworkspaceathenaaclsandbox2libraryAthenaAcl.php(9): Zend_Registry::get('configs/applica...')
#1 C:UsersjrsanfilippoDownloadsworkspaceathenaaclsandbox2applicationBootstrap.php(42): Athena_Acl->__construct()
#2 C:UsersjrsanfilippoDownloadsworkspaceathenaaclsandbox2libraryendApplicationBootstrapBootstrapAbstract.php(662): Bootstrap->_initActionPlugins()
#3 C:UsersjrsanfilippoDownloadsworkspaceathenaaclsandbox2libraryendApplicationBootstrapBootstrapAbstract.php(615): Zend_Application_Bootstrap_BootstrapAbstract->_executeResource('actionplugins')
#4 C:UsersjrsanfilippoDownloadsworkspaceathenaaclsandbox2libraryendApplicationBootstrapBootstrapAbstract.php(579): Zend_Application_Bootstrap_BootstrapAbstract->_bootstrap(NULL)
#5 C:UsersjrsanfilippoDownloadsworkspaceathenaaclsandbox2libraryendApplication.php(335): Zend_Application_Bootstrap_BootstrapAbstract->bootstrap()
#6 C:UsersjrsanfilippoDownloadsworkspaceathenaaclsandbox2publicindex.php(29): Zend_Application->bootstrap()


------------------------------------
So it appears that I am getting further down in the app. But I am still not there yet.


Kind Regards,
John

Message was edited by:
jrsanfilippo