【发布时间】:2018-05-12 01:08:43
【问题描述】:
当我为我的项目创建一个 docker 入口点脚本时,我会运行:
php /bin/composer install --no-dev
但是会抛出一个异常:
致命错误:未捕获 Symfony\Component\Debug\Exception\ClassNotFoundException:尝试从命名空间“Ajgl\Twig\Extension\SymfonyBundle”加载类“AjglBreakpointTwigExtensionBundle”。
AppKernel.php 上初始化捆绑包的代码是:
public function registerBundles()
{
//Other Bundle initialization
if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {
$bundles[] = new Ajgl\Twig\Extension\SymfonyBundle\AjglBreakpointTwigExtensionBundle();
}
return $bundles;
}
我在 dev 和 test 使用过的环境中使用 int。我构建的容器用于生产。
因此,我想以某种方式让 ScriptHandlers 在 composer 执行时,theese 运行在 prod 环境而不是 dev 环境中以抑制错误消息?
【问题讨论】:
标签: php symfony composer-php symfony-3.3 docker-entrypoint