Can't find controller using LazyControllerAbstractFactory with admin tool created RPC
nomadinteractif opened this issue · 0 comments
nomadinteractif commented
###
Bug Report
Can't generate $requestedName Class in Laminas\Mvc\Controller\LazyControllerAbstractFactory [102]
$reflectionClass = new ReflectionClass($requestedName);
Q | A |
---|---|
Version(s) | 1.5.1 dev |
Summary
I would like to use LazyControllerAbstractFactory for multiple Rpc Controller with same behavior.
Current behavior
When creating a new Rpc the mapping in the module.config.php will be generated like so:
//...
'controllers' => [
'factories' => [
'Clients\\V1\\Rpc\\GetClientDetail\\Controller' => \Clients\V1\Rpc\GetClientDetail\GetClientDetailControllerFactory::class
],
],
// ...
'clients.rpc.get-client-detail' => [
'type' => 'Segment',
'options' => [
'route' => '/clients/details',
'defaults' => [
'controller' => 'Clients\\V1\\Rpc\\GetClientDetail\\Controller',
'action' => 'getClientDetail',
],
],
],
// ... and more using same class mapping 'Clients\\V1\\Rpc\\GetClientDetail\\Controller'
Than in Laminas\Mvc\Controller\LazyControllerAbstractFactory [102]
// $requestedName = "Clients\V1\Rpc\GetClientDetail\Controller" // same used as in the module.config.php
$reflectionClass = new ReflectionClass($requestedName); // throw ReflexionException "Class "Clients\V1\Rpc\GetClientDetail\Controller" does not exist"
How to reproduce
Simply use any Controller class mapping in config and
$reflectionClass = new ReflectionClass("My\V1\Rpc\Module\Controller");
Expected behavior
I have tried to find/replace
'Clients\\V1\\Rpc\\GetClientDetail\\Controller'
with
\Clients\V1\Rpc\GetClientDetail\GetClientDetailController::class
in all the the module.config.php and this resolve the problem.
Thank you