-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Autoloading not functional with custom namespaces outside application dir #529
Comments
First, thanks for bringing this up over here. Much easier than Disqus comments. :) And I just noticed something as I read over the email. I believe what's currently needed is to add a new namespace for each module, like:
IIRC, the file locater simply looks for the exact folder match, it doesn't do any scanning of sub-folders for possible matches. This has the benefit, though, that your classes would have a better namespacing (Test instead of Modules\Test). Let me know if that works for you. If not, I'll try to look into it tonight. |
Yeah I thought of that too within my tests, and changing too Would the modules/Test/Config/Routes.php require something that would cause it to ignore? but it does look like it's unable to locate the file location itself. Maybe something to add with the debug system, "location failed" so its not a silent result. |
Ok this has actually been resolved. Thanks for your help. You did provide with the solution on the directories. However, What I did notice is I also had to move the |
Oh, gotcha. Glad you got it working. |
This could not be an issue at all, or that I am missing something so trivial and that I am sorry, but from looking at both of these pages, I am unable to replicate the functionality desired here.
https://bcit-ci.github.io/CodeIgniter4/general/modules.html
http://blog.newmythmedia.com/blog/show/2016-03-15_Modules_in_CodeIgniter_4
Added in application/Config/Autoload.php
Directory exist above the application directory called "modules"
File exists under:
modules/Test/Config/Routes.php
Adding this to the end of the file of application/Config/Routes.php
The print returns array of the application and system Routes.php files, and completely ignored my custom modules/Test/Config/Routes.php
Array ( [0] => ~/application/Config/Routes.php [1] => ~/system/Config/Routes.php )
So from my current tests, I am unable to get custom namespaces (directories) working from the autoload class. Basically its unrecognizable by the psr4 system. So that must be something it can not find within my custom directories?
If anyone can point out a mistake or lead me in the right direction that would be great, otherwise from both of the pages listed above, following the step by step instructions didn't seem to work.
The text was updated successfully, but these errors were encountered: