Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't find controller using LazyControllerAbstractFactory with admin tool created RPC #96

Open
nomadinteractif opened this issue Nov 30, 2023 · 0 comments
Labels
Bug Something isn't working

Comments

@nomadinteractif
Copy link

nomadinteractif commented Nov 30, 2023

### 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

@nomadinteractif nomadinteractif added the Bug Something isn't working label Nov 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant