Skip to content

Bug: Shield controllers are using default App namespace when extending BaseController - when namespace is changed, class can't be found #1291

@simun-ivanac

Description

@simun-ivanac

PHP Version

8.2.24

CodeIgniter4 Version

4.6.3

Shield Version

1.2.0

Which operating systems have you tested for this bug?

Windows

Which server did you use?

apache

Database

MySQL 8.0.33

Did you customize Shield?

No.

What happened?

ERROR: Class "App\Controllers\BaseController" not found.

Image

Steps to Reproduce

  1. change default namespace in app/Config/Constants.php
Image
  1. move controllers under GymApp\Controllers namespace.
Image
  1. install shield
  2. add service in app/Config/Routes.php
Image
  1. set controller filters in app/Config/Filters.php
Image

Expected Output

All pages should be protected by login, except ignored routes. It should work out of the box.

Anything else?

I know that it makes completely sense that I get an error. I'd like to know if there is any other way to make it to work except reverting namespace to default or copy/pasting controllers from vendor to app (which is not recommended at all...). If I'm missing something, feel free to correct me.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions