Skip to content

fix: spark routes does not show routes at all #6270

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

Merged
merged 1 commit into from
Jul 24, 2022

Conversation

kenjis
Copy link
Member

@kenjis kenjis commented Jul 16, 2022

Description
Follow-up #6110

  • add loading of Conig/Routes.php

Before:

+--------+-------+---------+----------------+---------------+
| Method | Route | Handler | Before Filters | After Filters |
+--------+-------+---------+----------------+---------------+

After:

+--------+-------+------------------------------+----------------+---------------+
| Method | Route | Handler                      | Before Filters | After Filters |
+--------+-------+------------------------------+----------------+---------------+
| GET    | /     | \App\Controllers\Home::index |                | toolbar       |
+--------+-------+------------------------------+----------------+---------------+

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@kenjis kenjis added bug Verified issues on the current code behavior or pull requests that will fix them 4.3 labels Jul 16, 2022
@kenjis kenjis mentioned this pull request Jul 16, 2022
5 tasks
@kenjis kenjis changed the title fix: spark routes does not show routes at all fix: spark routes does not show routes at all Jul 16, 2022
@lonnieezell
Copy link
Member

A couple of thoughts:

1- when did this break? I used this on a 4.2.1 install a couple of nights ago and it works fine.
2- this only loads a single routes file - it doesn’t scan all of the namespaces for routes confit files. Or was this one file being missed when it was trying to locate all of the files? If so - we need to figure out why and fix it there.

@kenjis
Copy link
Member Author

kenjis commented Jul 16, 2022

  1. on 4.3 branch. This is because of Extracting the call handler for Spark commands from kernel. #6110

  2. Yes, but the call of getRoutes() scans module routes. So no problem.

    $routes = $collection->getRoutes($method);

@kenjis
Copy link
Member Author

kenjis commented Jul 16, 2022

I tested with Shield and works fine.

$ php spark routes

CodeIgniter v4.2.1 Command Line Tool - Server Time: 2022-07-15 23:33:02 UTC-05:00

+--------+-------------------------+--------------------+--------------------------------------------------------------------+----------------+---------------+
| Method | Route                   | Name               | Handler                                                            | Before Filters | After Filters |
+--------+-------------------------+--------------------+--------------------------------------------------------------------+----------------+---------------+
| GET    | /                       |                    | \App\Controllers\Home::index                                       |                | toolbar       |
| GET    | register                |                    | \CodeIgniter\Shield\Controllers\RegisterController::registerView   |                | toolbar       |
| GET    | login                   |                    | \CodeIgniter\Shield\Controllers\LoginController::loginView         |                | toolbar       |
| GET    | login/magic-link        | magic-link         | \CodeIgniter\Shield\Controllers\MagicLinkController::loginView     |                | toolbar       |
| GET    | login/verify-magic-link | verify-magic-link  | \CodeIgniter\Shield\Controllers\MagicLinkController::verify        |                | toolbar       |
| GET    | logout                  |                    | \CodeIgniter\Shield\Controllers\LoginController::logoutAction      |                | toolbar       |
| GET    | auth/a/show             | auth-action-show   | \CodeIgniter\Shield\Controllers\ActionController::show             |                | toolbar       |
| POST   | register                |                    | \CodeIgniter\Shield\Controllers\RegisterController::registerAction |                | toolbar       |
| POST   | login                   |                    | \CodeIgniter\Shield\Controllers\LoginController::loginAction       |                | toolbar       |
| POST   | login/magic-link        |                    | \CodeIgniter\Shield\Controllers\MagicLinkController::loginAction   |                | toolbar       |
| POST   | auth/a/handle           | auth-action-handle | \CodeIgniter\Shield\Controllers\ActionController::handle           |                | toolbar       |
| POST   | auth/a/verify           | auth-action-verify | \CodeIgniter\Shield\Controllers\ActionController::verify           |                | toolbar       |
+--------+-------------------------+--------------------+--------------------------------------------------------------------+----------------+---------------+

@kenjis
Copy link
Member Author

kenjis commented Jul 22, 2022

This bug has not been released, but it is terrible and I would like to merge this.
Someone please review.

Copy link
Member

@MGatner MGatner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is correct. I have worked with our strange way of seeding routes recently and this is how you have to do it.

@kenjis kenjis merged commit e551d33 into codeigniter4:4.3 Jul 24, 2022
@kenjis kenjis deleted the fix-spark-routes branch July 24, 2022 00:26
@kenjis kenjis removed the bug Verified issues on the current code behavior or pull requests that will fix them label Oct 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants