When I create a docker entrypoint script for my project I run:
php /bin/composer install --no-dev
But thhat throws an exception that is:
Fatal error: Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "AjglBreakpointTwigExtensionBundle" from namespace "Ajgl\Twig\Extension\SymfonyBundle".
The code over the AppKernel.php
that initializes the bundle is:
public function registerBundles()
{
//Other Bundle initialization
if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {
$bundles[] = new Ajgl\Twig\Extension\SymfonyBundle\AjglBreakpointTwigExtensionBundle();
}
return $bundles;
}
This bundle I use int on dev
and test
environments where it has use. The container I build is for production use.
Therefore I want somehow to let the ScriptHandlers that when composer executes, theese run over a prod
environment and not a dev
one in order to supress the error message?
I suppose this is a duplicate of this issue.
Just set the SYMFONY_ENV
var to prod
and use composer install
then:
SYMFONY_ENV=prod php /bin/composer install --no-dev