jeudi 30 janvier 2020

Laravel's alias loader does not find class

We have a legacy project that we cannot update and we need to make some changes in symfony's Response.php in vendor. We have solved this by copying Response.php to a separate folder and using an alias to load that new class instead of vendor's. We did this in AppServiceProvider:

public function boot()
    {
        AliasLoader::getInstance()->alias('Symfony\Component\HttpFoundation\Response', 'App\Overrides\Response');
...

public function provides()
    {
        return ['Symfony\Component\HttpFoundation\Response'];

It worked fine until we pushed to production and suddenly it stopped working. While it still works fine on our dev servers. We can clearly see that the original class from vendor is being loaded instead of the one from Overrides so for some reason the alias doesn't work. Does anyone have any clue as to what could cause this? Don't even know where to start or what sorts of settings or artisan commands could have caused this behaviour.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2SbbK42
via IFTTT

Aucun commentaire:

Enregistrer un commentaire