Skip to content

CustomController name has to be prefixed with namespace. Otherwise class not found error #1066

Description

@devarajhansa

If defined in api.php, CustomController name has to be prefixed with namespace. Otherwise class not found error
Or you have to change the code to prefix the class name with namespace before class_exists() check.

    'customControllers' => '\\Tqdev\\PhpCrudApi\\MyHelloController',

or

        foreach ($config->getCustomControllers() as $className) {
            $pathName = '\\Tqdev\\PhpCrudApi\\' . $className;
            //if (class_exists($className)) {
            //    new $className($router, $responder, $db, $reflection, $cache);
            if (class_exists($pathName)) {
                new $pathName($router, $responder, $db, $reflection, $cache);
            }
        }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions