Heya!

That's what the `init` method is for. Right now Modules must have a
zero-argument-constructor.

Can you explain your use case?

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


On 19 April 2013 22:55, Ferns Glez [via Zend Framework Community] <
[email protected]> wrote:

> Hello guys,
>
> I need to access the module manager reference in the constructor of a
> module class, the problem is: how?
> I see that is only possible via the init() method, but I need to access to
> it before, in the __construct() method. Is it possible?
>
> The only way I found is modifying the class
> "Zend\ModuleManager\Listener\ModuleResolverListener" in the Zend Framework
> by adding the target of the event to the class instantiation:
> $module = new $class($e->getTarget());
>
> So, I can access to the module manager reference in the module
> constructor:
>
> namespace MyModule;
> class Module {
>     public function __construct(ModuleManager $manager) {
>         $this->moduleManager=$manager;
>     }
> }
>
> Another solution?
> What do you think about send a pull request to modify permanently the
> ModuleResolverListener?
>
> Thanks a lot, Ferns G.
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://zend-framework-community.634137.n4.nabble.com/Access-the-module-manager-reference-in-the-constructor-of-a-module-class-tp4659794.html
>  To start a new topic under Zend Framework, email
> [email protected]
> To unsubscribe from Zend Framework Community, click 
> here<http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=634137&code=b2NyYW1pdXNAZ21haWwuY29tfDYzNDEzN3wxNzE0OTI1MTk4>
> .
> NAML<http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Access-the-module-manager-reference-in-the-constructor-of-a-module-class-tp4659794p4659806.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to