Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Loading action helpers with the prefix path loader
<?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/')
)
)
)
);
@Thinkscape

This comment has been minimized.

Copy link

commented Jul 27, 2011

You need to supply the class loader at resource-loading time. I.e.

$application = new \Zend\Application(array(
'resources' => array('frontcontroller' => .. ............. )
));
@robertbasic

This comment has been minimized.

Copy link
Owner Author

commented Jul 27, 2011

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 can’t perform that action at this time.