Skip to content

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

@devarajhansa

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);
            }
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions