How configure Zend\Di

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How configure Zend\Di

edipoReboucas
I need a help with Zend\Di;

I'm tired on the task of write factories to my application using the Zend\ServiceManager, I want to understand how work the configuration in MVC environment of Zend\Di.


I see this post of @Ocramius (http://ocramius.github.io/blog/zend-framework-2-controllers-and-dependency-injection-with-zend-di/, with some configuration in the `module.config.php`, in the top key `di`:

    <?php
   
    return array(
        'di' => array(
            'allowed_controllers' => array(
                // this config is required, otherwise the MVC won't even attempt to ask Di for the controller!
                'Application\Controller\GreetingController',
            ),
   
            'instance' => array(
                'preference' => array(
                    // these allow injecting correct EventManager and ServiceManager
                    // (taken from the main ServiceManager) into the controller,
                    // because Di doesn't know how to retrieve abstract types. These
                    // dependencies are inherited from Zend\Mvc\Controller\AbstractController
                    'Zend\EventManager\EventManagerInterface' => 'EventManager',
                    'Zend\ServiceManager\ServiceLocatorInterface' => 'ServiceManager',
                ),
            ),
        ),
        // remaining config
    );


Anyone can post a url to the doc of this configuration or more detailed examples here?
Reply | Threaded
Open this post in threaded view
|

Re: How configure Zend\Di

samsonasik
This post has NOT been accepted by the mailing list yet.
Zend\Di is buggy and slow. use ServiceManager instead.
Reply | Threaded
Open this post in threaded view
|

Re: How configure Zend\Di

edipoReboucas

For now, I will use another Di container.

Em 14/11/2014 03:57, "samsonasik [via Zend Framework Community]" <[hidden email]> escreveu:
Zend\Di is buggy and slow. use ServiceManager instead.


If you reply to this email, your message will be added to the discussion below:
http://zend-framework-community.634137.n4.nabble.com/How-configure-Zend-Di-tp4662374p4662382.html
To start a new topic under Zend Framework, email [hidden email]
To unsubscribe from Zend Framework, click here.
NAML