|
7 | 7 | use Bitrix\Main\Routing\RoutingConfigurator;
|
8 | 8 | use LogicException;
|
9 | 9 | use RuntimeException;
|
10 |
| -use Symfony\Component\DependencyInjection\ContainerAwareTrait; |
11 | 10 | use Symfony\Component\Routing\Route;
|
12 | 11 | use Symfony\Component\Routing\RouteCollection;
|
13 | 12 |
|
|
19 | 18 | */
|
20 | 19 | class BitrixRouteConvertor
|
21 | 20 | {
|
22 |
| - use ContainerAwareTrait; |
23 |
| - |
24 | 21 | /**
|
25 | 22 | * @var RouteCollection $routeCollection Коллекция роутов.
|
26 | 23 | */
|
@@ -91,24 +88,14 @@ public function convertRoute(string $name, Route $route, RoutingConfigurator $ro
|
91 | 88 | );
|
92 | 89 | }
|
93 | 90 |
|
94 |
| - // Достаю из контейнера, только если он задан. |
95 |
| - if ($this->container !== null) { |
96 |
| - if (!$this->container->has($controller[0])) { |
97 |
| - throw new RuntimeException( |
98 |
| - sprintf('Controller %s not registered as service', $controller[0]) |
99 |
| - ); |
100 |
| - } |
101 |
| - |
102 |
| - $service = $this->container->get($controller[0]); |
103 |
| - } else { |
104 |
| - if (!class_exists($controller[0])) { |
105 |
| - throw new RuntimeException( |
106 |
| - sprintf('Class %s not exist.', $controller[0]) |
107 |
| - ); |
108 |
| - } |
109 |
| - $service = new $controller[0]; |
| 91 | + if (!class_exists($controller[0])) { |
| 92 | + throw new RuntimeException( |
| 93 | + sprintf('Class %s not exist.', $controller[0]) |
| 94 | + ); |
110 | 95 | }
|
111 | 96 |
|
| 97 | + $service = new $controller[0]; |
| 98 | + |
112 | 99 | $processedRoute = $routes->any($path, [$service, $controller[1]]);
|
113 | 100 |
|
114 | 101 | $processedRoute = $processedRoute->methods($methods)
|
|
0 commit comments