Loading action helpers with the prefix path loader
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Bootstrap { | |
public function _initActionHelpers() | |
{ | |
$this->bootstrap('FrontController'); | |
$fc = $this->getResource('FrontController'); | |
$fc->getHelperBroker() | |
->setClassLoader(new \Zend\Loader\PrefixPathLoader( | |
array( | |
array( | |
'prefix' => 'Zend\Controller\Action\Helper', | |
'path' => realpath(APPLICATION_PATH . '/../library/Zend/Controller/Action/Helper/') | |
), | |
array( | |
'prefix' => 'Planet\Controller\Helper', | |
'path' => realpath(APPLICATION_PATH . '/modules/public/controllers/helpers/') | |
) | |
) | |
) | |
); |
I just did this from the application.ini and it still works:
resources.frontcontroller.actionhelper.class = '\Zend\Controller\Action\HelperBroker' resources.frontcontroller.actionhelper.class_loader.class = 'Zend\Loader\PrefixPathLoader' resources.frontcontroller.actionhelper.class_loader.options.1.prefix = 'Zend\Controller\Action\Helper' resources.frontcontroller.actionhelper.class_loader.options.1.path = APPLICATION_PATH '/../library/Zend/Controller/Action/Helper' resources.frontcontroller.actionhelper.class_loader.options.2.prefix = 'Planet\Controller\Helper' resources.frontcontroller.actionhelper.class_loader.options.2.path = APPLICATION_PATH '/modules/public/controllers/helpers'
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You need to supply the class loader at resource-loading time. I.e.