chrismacp
chrismacp

Reputation: 3893

Adding action helper path in Zend Framework 1.11 for namespaced (5.3) classes

Does anyone know how to tell Zend Framework 1.11 how to find my namespaced action helper classes? I'm using proper PHP5.3 Namespaces so not the normal My_Helper etc.

I would love to do this without using an ini file also as I'm not using Zend_Application and don't really want to refactor all my set up.

I can register the view helper path fine with an ini file but cant get action helpers to work.

Working view helper ini config:

resources.view.helperPath.Foo\View\Helper\ = APPLICATION_PATH "/../library/Foo/View/Helper/"

Non-working action helper ini config:

resources.frontController.actionhelperpaths.Foo\Helper\ = APPLICATION_PATH "/../library/Foo/Helper/"

Cant seem to find any information about it?

If you know how to do it without using Ini files that would be awesome too :)

Upvotes: 2

Views: 696

Answers (1)

David Weinraub
David Weinraub

Reputation: 14184

AFAIK, although ZF1 autoloader can handle genuine PHP namespaces, neither the plugin loader used for view helpers nor the standard resource autoloader (typically used for models, forms, etc) can deal with genuine PHP-5.3 namespace path/prefix mappings (see here).

It is probably necessary to:

  • write your own plugin loader and feed it to the view during bootstrap
  • write your own resource autoloader and invoke it in application/model bootstraps.

Bummer. Hope I am wrong.

ZF2 - still in late beta as the time of this writing - is fully capable to dealing with true PHP namespaces.

Upvotes: 2

Related Questions