Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined Index Exception when DIC uses factory to get service #36

Closed
keymaster opened this issue Dec 1, 2011 · 3 comments
Closed

Undefined Index Exception when DIC uses factory to get service #36

keymaster opened this issue Dec 1, 2011 · 3 comments

Comments

@keymaster
Copy link

Received the following exception (using Symfony 2.05 release):

An exception has been thrown during the rendering of a template ("Notice: Undefined index: acme_search.SearchFactory in C:\Program Files\Zend\Apache2\htdocs\Acme\vendor\bundles\JMS\DebuggingBundle\DataCollector\DiDataCollector.php line 101") in "JMSDebuggingBundle:Collector:container.html.twig" at line 140.

Here are the relevant service definitions:

    <service id="acme_search.SearchFactory" class="%acme_search.SearchFactory.class%" scope="request">
                    <argument type="service" id="acmecore_searchfilter.FilterManager" />
        <argument type="service" id="service_container" />
    </service>

    <service 
           id="acme_search.searcher" 
           class="%acmecore_searchfilter.SearcherInterface.class%" 
           scope="request" 
           factory-service="acme_search.SearchFactory"
               factory-method="make">
    </service>
@keymaster
Copy link
Author

The above exception occurs only when the DIC is asked to use a factory to create the service.

@stof
Copy link
Contributor

stof commented Mar 29, 2012

IMO, the real issue is a case-sensitivity one as I never saw such bugs for the Doctrine services using a factory service. The collector should probably lowercase all ids to avoid issues as the DI component is always using them lowercased

@schmittjoh
Copy link
Owner

The problem was in the TraceableContainer which did use the id as it was given to get or set. It now converts them to lower-case just like the super class.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants