How to pull routes in spark command |
Previously up to version 4.2.12 I can call
PHP Code: route_to('route_name') PHP Code: \app\Config\Routes.php I mainly used the command to send automated email with the link to a page in the application, and using the route_to function was a simple way to keep track of the routes. Any suggestion on how to do this now in 4.3.2? I don't recall in the upgrade instruction there was any information on how to do this. Thanks. After a quick check it seems that I can call "Services::routes()->loadRoutes();" and that loads all my custom routes in the spark command. But not sure if that's the correct approach. (03-28-2023, 05:07 PM)kenjis Wrote: See https://codeigniter.com/user_guide/insta...le-changes Do you mean I should add likeĀ PHP Code: require_once(SYSTEMPATH . 'Config/Routes.php') Or are you saying spark commands aren't meant to access the routes at all? That would be strange if the support was provided and just suddenly broken without explanation.
Sorry, I confused it with some kind of issue where the files were not updated enough.
Hey @kenjis, I'm having the same issue: route_to stopped working in spark commands from v4.3
I'm wondering if this was fixed in newer versions. Or is there any other way to access named routes in spark commands? Also, thank you for your work on CodeIgniter! EDIT: saw that @ciUser43 found a way to load routes using: PHP Code: Services::routes()->loadRoutes();
"php spark routes" is one way I came across in documentation to see the routes configured. Not sure if it will help in your situation,
Yes, you need to load the routes with Services::routes()->loadRoutes() now.
Maybe route_to() should load the route, though. |
Welcome Guest, Not a member yet? Register Sign In |