phpzend-frameworkdependency-injectionzend-viewzend-filter

Inject filter into Zend_View


I wish to set some properties in MyFilter with constructor injection but it seems impossible with Zend_View::addFilter(string $filter_class_name) since it loads a new instance upon usage. MyFilter implements Zend_Filter_Interface.

Can I somehow inject an instance of a filter to an instance of Zend_View?

Closing since it (hopefully) will be pushed into 2.0, see ticket on JIRA.


Solution

  • You can't in the 1.x branch, ticket is filed:

    http://framework.zend.com/issues/browse/ZF-9718