Closed
Description
Hello,
DoctrineBundle have made a change ir orm.xml (added lazy=true):
<service id="doctrine.orm.entity_manager.abstract" class="%doctrine.orm.entity_manager.class%" abstract="true" lazy="true" />
Now all my lazy services which are actually doctrine listeners stopped working (throws circular error).
After couple of hours of debugging I've found out a bug (hopefully) in PhpDumper.php
hasReference
method.
I've added a debugging echo lines in that method and saw these results:
hasReference: (doctrine.dbal.default_connection) , visited: doctrine.orm.default_listeners.attach_entity_listeners -> listener.event_logger -> doctrine.orm.default_entity_manager -> doctrine.orm.default_entity_manager.delegate (eq: false)
Service: doctrine.orm.default_entity_manager.delegate (lazy), has arguments: [ doctrine.dbal.default_connection, def: Doctrine\ORM\Configuration ]
hasReference: (doctrine.dbal.default_connection) , visited: doctrine.orm.default_listeners.attach_entity_listeners -> listener.event_logger -> doctrine.orm.default_entity_manager -> doctrine.orm.default_entity_manager.delegate -> doctrine.dbal.default_connection (eq: true)
It looks like hasReference also recursively looking up a lazy services arguments for reference search,
I've thought, is that really logically? Because lazy services is lazy and are instantiated indirectly so more logically would be skip reference search in lazy service definitions, isn't it?
more information:
doctrine/DoctrineBundle#559 (comment)