]> Raphaël G. Git Repositories - airbundle/commitdiff
Protect from getLocale call on empty request happening in console commands
authorRaphaël Gertz <git@rapsys.eu>
Thu, 7 Mar 2024 17:09:52 +0000 (18:09 +0100)
committerRaphaël Gertz <git@rapsys.eu>
Thu, 7 Mar 2024 17:09:52 +0000 (18:09 +0100)
Factory.php

index 7ab9c2ae2e501b4a8a19a77057f9e56be12509c3..a4211655c4f19a2dc150ba938fc575aa3018cabb 100644 (file)
@@ -74,7 +74,7 @@ final class Factory implements RepositoryFactory {
 
                //Set to current locale
                //XXX: current request is not yet populated in constructor
-               $this->locale = $this->request->getCurrentRequest()->getLocale() ?? $this->locale;
+               $this->locale = $this->request->getCurrentRequest()?->getLocale() ?? $this->locale;
 
                //Return repository class instance
                //XXX: router, slugger, translator, languages and locale arguments will be ignored by default