Skip to content

DI in ZF controllers #96

@marcelog

Description

@marcelog

Taken from #95, by jonathaningram

A question related to annotations: I want to inject a Service (say, my ProductsService) into my Controller (say, my ProductsController) via a property or method of the controller, however, the design of Zend is that when you request a resource (say abc.com/products/list), the controller is constructed automatically by Zend, which means that I cannot specify the controller as a bean in beans.xml and so the @resource won't be injected. Without intercepting ZF's creation of the controller and checking the beans container for a matching controller bean, is it possible to have the @resouce injected without having a bean of that class? Make sense?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions