-
-
Notifications
You must be signed in to change notification settings - Fork 324
Getting requested name when using wildcards #269
Copy link
Copy link
Closed
Labels
Milestone
Description
Hi, I tried to look through the docs and code about wilcard definitions but couldn't find what I wanted. Is it possible to get the requested service name in a wildcard factory?
return [
'Vendor\Package\Command\*Command' => factory(function (Container $c, $requestedName) {
$cmd = explode("\\", $requestedName)[3]; //DeployCommand
$cmd = substr($cmd, 0, -7); //Deploy
$commandService = $c->get(sprintf('%s/Service', $cmd));
return new $requestedName($commandService);
}),
];Maybe there is a better way to do what I am trying to accomplish?
Reactions are currently unavailable