Override User class in 8.1
Permalink
Hi,
In 5.7 I used a application specific User class by setting aliases in config/app.php:
'aliases' => array(
'User' => '\Application\Src\User\User',
)
I have now upgraded to 8.1 and this is not working anymore.
I tried either 'enable_legacy_src_namespace' => true, and moving it to a Concrete directory: User' => '\Application\Concrete\User\User', but neither works
It looks like the class is loaded, but I am now getting
Argument 1 passed to Concrete\Core\Page\Event::setUser() must be an instance of Application\Src\User\User, instance of Concrete\Core\User\User given
Any idea on how to solve this?
In 5.7 I used a application specific User class by setting aliases in config/app.php:
'aliases' => array(
'User' => '\Application\Src\User\User',
)
I have now upgraded to 8.1 and this is not working anymore.
I tried either 'enable_legacy_src_namespace' => true, and moving it to a Concrete directory: User' => '\Application\Concrete\User\User', but neither works
It looks like the class is loaded, but I am now getting
Argument 1 passed to Concrete\Core\Page\Event::setUser() must be an instance of Application\Src\User\User, instance of Concrete\Core\User\User given
Any idea on how to solve this?
Thanks for your reply. As said in my initial post, I already tried that and it seems the class is loaded succesfully. I am getting a different error message
Sorry; I didn't read the question properly (as you know).
I can't help but wonder if the use of an alias is outsmarting symfony's devious machinations.
I can't help but wonder if the use of an alias is outsmarting symfony's devious machinations.
My guess is that not all code is using the alias, and thus when changing the alias you will get a type conflict.
https://www.concrete5.org/community/forums/customizing_c5/migrating-...