You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/Symfony/Component/Routing/Loader/ObjectRouteLoader.php
+11-3
Original file line number
Diff line number
Diff line change
@@ -44,9 +44,17 @@ abstract protected function getServiceObject($id);
44
44
*/
45
45
publicfunctionload($resource, $type = null)
46
46
{
47
-
$parts = explode(':', $resource);
47
+
if (1 === substr_count($resource, ':')) {
48
+
$resource = str_replace(':', '::', $resource);
49
+
@trigger_error(sprintf(
50
+
'Referencing service route loaders with a single colon is deprecated since version 4.1 and will be removed in 5.0. Use %s instead.',
51
+
$resource
52
+
), E_USER_DEPRECATED);
53
+
}
54
+
55
+
$parts = explode('::', $resource);
48
56
if (2 != count($parts)) {
49
-
thrownew \InvalidArgumentException(sprintf('Invalid resource "%s" passed to the "service" route loader: use the format "service_name:methodName"', $resource));
57
+
thrownew \InvalidArgumentException(sprintf('Invalid resource "%s" passed to the "service" route loader: use the format "service::method"', $resource));
50
58
}
51
59
52
60
$serviceString = $parts[0];
@@ -58,7 +66,7 @@ public function load($resource, $type = null)
58
66
thrownew \LogicException(sprintf('%s:getServiceObject() must return an object: %s returned', get_class($this), gettype($loaderObject)));
59
67
}
60
68
61
-
if (!method_exists($loaderObject, $method)) {
69
+
if (!is_callable(array($loaderObject, $method)))q {
62
70
thrownew \BadMethodCallException(sprintf('Method "%s" not found on "%s" when importing routing resource "%s"', $method, get_class($loaderObject), $resource));
* @expectedDeprecation Referencing service route loaders with a single colon is deprecated since version 4.1 and will be removed in 5.0. Use my_route_provider_service::loadRoutes instead.
0 commit comments