14
14
use Symfony \Component \DependencyInjection \ContainerBuilder ;
15
15
use Symfony \Component \DependencyInjection \Reference ;
16
16
use Symfony \Component \DependencyInjection \Compiler \CompilerPassInterface ;
17
+ use Symfony \Component \DependencyInjection \Exception \InvalidArgumentException ;
18
+ use Symfony \Component \DependencyInjection \Exception \RuntimeException ;
17
19
18
20
/**
19
21
* Registers event listeners and subscribers to the available doctrine connections.
@@ -77,7 +79,7 @@ public function process(ContainerBuilder $container)
77
79
uasort ($ subscribers , $ sortFunc );
78
80
foreach ($ subscribers as $ id => $ instance ) {
79
81
if ($ container ->getDefinition ($ id )->isAbstract ()) {
80
- throw new \ InvalidArgumentException (sprintf ('The abstract service "%s" cannot be tagged as a doctrine event subscriber. ' , $ id ));
82
+ throw new InvalidArgumentException (sprintf ('The abstract service "%s" cannot be tagged as a doctrine event subscriber. ' , $ id ));
81
83
}
82
84
83
85
$ em ->addMethodCall ('addEventSubscriber ' , array (new Reference ($ id )));
@@ -93,7 +95,7 @@ public function process(ContainerBuilder $container)
93
95
uasort ($ listeners , $ sortFunc );
94
96
foreach ($ listeners as $ id => $ instance ) {
95
97
if ($ container ->getDefinition ($ id )->isAbstract ()) {
96
- throw new \ InvalidArgumentException (sprintf ('The abstract service "%s" cannot be tagged as a doctrine event listener. ' , $ id ));
98
+ throw new InvalidArgumentException (sprintf ('The abstract service "%s" cannot be tagged as a doctrine event listener. ' , $ id ));
97
99
}
98
100
99
101
$ em ->addMethodCall ('addEventListener ' , array (
@@ -116,7 +118,7 @@ private function groupByConnection(array $services, $isListener = false)
116
118
foreach ($ instances as $ instance ) {
117
119
if ($ isListener ) {
118
120
if (!isset ($ instance ['event ' ])) {
119
- throw new \ InvalidArgumentException (sprintf ('Doctrine event listener "%s" must specify the "event" attribute. ' , $ id ));
121
+ throw new InvalidArgumentException (sprintf ('Doctrine event listener "%s" must specify the "event" attribute. ' , $ id ));
120
122
}
121
123
$ instance ['event ' ] = array ($ instance ['event ' ]);
122
124
@@ -128,7 +130,7 @@ private function groupByConnection(array $services, $isListener = false)
128
130
$ cons = isset ($ instance ['connection ' ]) ? array ($ instance ['connection ' ]) : $ allCons ;
129
131
foreach ($ cons as $ con ) {
130
132
if (!isset ($ grouped [$ con ])) {
131
- 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 ))));
133
+ 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 ))));
132
134
}
133
135
134
136
if ($ isListener && isset ($ grouped [$ con ][$ id ])) {
0 commit comments