Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,12 @@ private function addTaggedListeners(ContainerBuilder $container)
throw new RuntimeException(sprintf('The Doctrine connection "%s" referenced in service "%s" does not exist. Available connections names: %s', $con, $id, implode(', ', array_keys($this->connections))));
}

if ($lazy = isset($tag['lazy']) && $tag['lazy']) {
if ($lazy = !empty($tag['lazy'])) {
$taggedListenerDef->setPublic(true);
}

// we add one call per event per service so we have the correct order
$this->getEventManagerDef($container, $con)->addMethodCall('addEventListener', array(
$tag['event'],
$lazy ? $id : new Reference($id),
));
$this->getEventManagerDef($container, $con)->addMethodCall('addEventListener', array(array($tag['event']), $lazy ? $id : new Reference($id)));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ public function testProcessEventListenersWithPriorities()

$this->assertEquals(
array(
array('addEventListener', array('foo_bar', new Reference('c'))),
array('addEventListener', array('foo_bar', new Reference('a'))),
array('addEventListener', array('bar', new Reference('a'))),
array('addEventListener', array('foo', new Reference('b'))),
array('addEventListener', array('foo', new Reference('a'))),
array('addEventListener', array(array('foo_bar'), new Reference('c'))),
array('addEventListener', array(array('foo_bar'), new Reference('a'))),
array('addEventListener', array(array('bar'), new Reference('a'))),
array('addEventListener', array(array('foo'), new Reference('b'))),
array('addEventListener', array(array('foo'), new Reference('a'))),
),
$methodCalls
);
Expand Down Expand Up @@ -138,16 +138,16 @@ public function testProcessEventListenersWithMultipleConnections()

$this->assertEquals(
array(
array('addEventListener', array('onFlush', new Reference('a'))),
array('addEventListener', array('onFlush', new Reference('b'))),
array('addEventListener', array(array('onFlush'), new Reference('a'))),
array('addEventListener', array(array('onFlush'), new Reference('b'))),
),
$container->getDefinition('doctrine.dbal.default_connection.event_manager')->getMethodCalls()
);

$this->assertEquals(
array(
array('addEventListener', array('onFlush', new Reference('a'))),
array('addEventListener', array('onFlush', new Reference('c'))),
array('addEventListener', array(array('onFlush'), new Reference('a'))),
array('addEventListener', array(array('onFlush'), new Reference('c'))),
),
$container->getDefinition('doctrine.dbal.second_connection.event_manager')->getMethodCalls()
);
Expand Down