Skip to content
Snippets Groups Projects
Commit f38dba3a authored by Dorian Merz's avatar Dorian Merz Committed by Robert Lange
Browse files

refs #20897 [fid] generalize UserControllerFactory to work with inherited classes

parent 66242405
Branches
Tags
No related merge requests found
......@@ -49,15 +49,17 @@ class UserControllerFactory
/**
* Invoke method for user controller
*
* @param ContainerInterface|ServiceLocatorInterface $container Service container
* @param ContainerInterface $container Service container
* @param string $requestedName Name of the class to instantiate
* (must inherit fid\Controller\UserController)
*
* @return UserController
*/
public function __invoke(ContainerInterface $container)
public function __invoke(ContainerInterface $container, $requestedName)
{
$client = $container->get(Client::class);
$authManager = $container->get(AuthManager::class);
$config = $container->get(ConfigManager::class)->get('fid')->toArray();
return new UserController($container, $authManager, $client, $config);
return new $requestedName($container, $authManager, $client, $config);
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment