-
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
Problem with Sth3Model loading from Sth2Model when Sth3Model is in subdiretory (Subdir1) #605
Comments
Hmm. I think there was only one change in that commit that might have affected this, but it was fixing an existing bug in the FileLocater algorithm, I believe. How are your model's namespaced, and your namespace defined within Config/Autoload? Or are they not namespaced at all? It looks to me like the call should be: |
Ofc I tried also sth like \App\Models... so I had to changed my code. ` namespace Subdir1;
} ` and from other class which is 1 level up (root of models directory) i tried to create AbcModel()
but it ended with the same exception. There is nth special in Autoload: `
` |
The namespace of the AbcModel class is wrong. It should be |
Yeah, sorry for that, but I'm sure it was working in that way before cause I've got copy with previous code where namespace was only Subdir1 . Sth has been changed from previous version. |
Did the previous version actually have a namespace defined in the class? It's possible that it might have worked without a namespace, though I honestly haven't tried that in a while. With a namespace though, it's not possible for it to work that way. |
Real code:
|
What you're showing there should not work. With a namespace of Admin and a class name of UserLoginModel, and no separate Don't know what to tell you other than that's simply how namespacing and the PSR4 autoloading work. There's no magic |
Inside Models directory I've got:
inside one method of Sth2Model I'm creating Sth3Model
$st3 = new \Subdir1\Sth3Model();
after update my project to the newest version (commit: a5b6d93) one problem appears:
Error Class 'Subdir1\Sth3Model' not found
in that line from Sth1Model:
$sthSth = new \Subdir1\Sth3Model();
The text was updated successfully, but these errors were encountered: