Symfony bin/console breaking with env arg

43 views Asked by At

Using Symfony 6.2, running:

bin/console list

Works as expected - shows me a list of commands. However, running the same command using the prod env flag, gives me an error:

bin/console -e prod list

Expected to find class "[My local classname]" in file "[path to my local classname]"
while importing services from resource "../src/", but it was not found! 
Check the namespace prefix used with the resource in [docroot]/config/services.yaml
 (which is being imported from "[docroot]/src/Kernel.php").    

The my classname file exists and works as expected (ie, I'm using it fine in the dev env), and the Kernel.php file is boilerplate.

How do I avoid this? Isn't the prod env using the same services.yaml file?

1

There are 1 answers

0
dbcn On

Doh - the file for the my class class the error referenced did not have a namespace declared...

[insert facepalm]