如何在 symfony2 中禁用数据库配置 [英] how to disable database configuration in symfony2

查看:23
本文介绍了如何在 symfony2 中禁用数据库配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发的新应用使用 Symfony2.没有要使用的数据库连接.相反,它建立在许多 Web 服务调用之上.在 Symfony/app/config 下,我想删除所有 database_* 条目,但是当我这样做时,我得到一个

The new app I'm working on is using Symfony2. There is no database connection to use. Instead it's build upon many web service calls. Under Symfony/app/config, I would like to remove all database_* entries but when I do that, I get a

ParameterNotFoundException: You have requested a non-existent parameter "database_driver"

错误很明显.但是如何从应用程序本身分离和删除数据库配置?

The error is obvious. But how do I decouple and remove the database configs from the app itself?

推荐答案

从你的 AppKernel 和 doctrine 配置中移除 DoctrineBundle 初始化从你的 app/config/config*.yml文件.它在容器中注册学说配置.这就是为什么当您尝试删除参数时容器会抱怨的原因(已启用捆绑包并查找这些参数).

Remove DoctrineBundle initialisation from your AppKernel and doctrine configuration from your app/config/config*.yml files. It registers doctrine configuration in the container. That's why container complains if you try removing the parameters (bundle is enabled and looks for those parameters).

在最新版本的 Symfony 中,您还需要从 config_dev.yml 中的 Monolog 配置中删除学说频道(删除 channels: ["doctrine"] 行).

In latest versions of Symfony you'll also need to remove the doctrine channel from monolog configuration in config_dev.yml (remove the channels: ["doctrine"] line).

这篇关于如何在 symfony2 中禁用数据库配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆