Update from 5.7.13 to 8.5.1
Permalink
Tried to update on a test site and running into multiple problems. I get the following message: Class 'Application\Src\Photography\Base' not found in my bootstrap app.php file:
I've tried to include "Concrete" in the above code after Src and also in the namespace of the base.php file, as read on a thread in stackoverflow, but that seems not to help.
Adding 'enable_legacy_src_namespace' => true, to config/app.php didn't seem to work either. Plus you never know when they disable this helpful feature if it would work.
Edit:
---------------
I've deactivated everything and went back to basics, without helper implementation, but it still isn't working. What do I do wrong?
1. I've got a file in /src/concrete/Photography/Base.php
It has the following namespace:
2. I've got a call to this in a controller file:
I also call a method in the view method of the controller:
But I get the following error:
Core::bind('helper/Base', function() { return new \Application\Src\Photography\Base(); });
I've tried to include "Concrete" in the above code after Src and also in the namespace of the base.php file, as read on a thread in stackoverflow, but that seems not to help.
Adding 'enable_legacy_src_namespace' => true, to config/app.php didn't seem to work either. Plus you never know when they disable this helpful feature if it would work.
Edit:
---------------
I've deactivated everything and went back to basics, without helper implementation, but it still isn't working. What do I do wrong?
1. I've got a file in /src/concrete/Photography/Base.php
It has the following namespace:
namespace Application\Src\Concrete\Photography; class Base{ .....
2. I've got a call to this in a controller file:
use \Application\Src\Concrete\Photography\Base;
I also call a method in the view method of the controller:
$blah = Base::cms_ISO88591_encode("üäö");
But I get the following error:
Class 'Application\Src\Concrete\Photography\Base' not found
There was a change to namespaces and autoloaders between 5.7 and v8. Perhaps that is affecting your custom class.
Yes, I've found this:https://stackoverflow.com/questions/41521943/class-not-found-error-w... but it doesn't seem to solve my problem. So maybe even more has been changed meanwhile or I do something wrong?
Maybe Custom Helper Classes can't be created like this anymore?
Maybe Custom Helper Classes can't be created like this anymore?
For my work I always use packages and declare my own namespace mapping using getPackageAutoloaderRegistries(), hence declaring exactly what is mapped rather than trusting to the unknown and shifting quirks of the built-in autoloading.
I expect there is an equivalent for classes in /application/src/, but have never needed to use it.
I expect there is an equivalent for classes in /application/src/, but have never needed to use it.
Looking at the S.O thread you reference, there is no 'src' in the namespace.
Yes, that fixed it. I took that as a typo to be honest. Makes not much sense for me that the path is not accurate, but without the src it works.
Thank you!
Thank you!