gpt4 book ai didi

php - 如何在生产环境中访问 Doctrine 分析器?

转载 作者:行者123 更新时间:2023-12-04 05:09:15 32 4
gpt4 key购买 nike

我设置了一个过滤器来计算执行的查询数量,并在超过某个限制时将一些内容写入我的数据库。

它在我的开发环境中运行良好,但是当我在生产环境中测试它时,我的数据库不再返回分析器。我认为这是一个为开发环境启用数据库分析器的设置,但我似乎找不到它。

我使用 Symfony1.4 和 Doctrine。

$database = $databaseManager->getDatabase($name);
if ($database instanceof sfDoctrineDatabase && $profiler = $database->getProfiler())
{
$events = $profiler->getQueryExecutionEvents();
}

最佳答案

您可以使用 profiler 强制分析器在 database.yml 中建立连接。选项:

prod:
master:
class: sfDoctrineDatabase
param:
profiler: true
dsn: 'mysql:host=localhost;dbname=dbname'
username: username
password: password

Indicates whether to output doctrine log to the debug toolbar. The default value of profiler depends on the environment. In development environment the default value is true, otherwise - false.

关于php - 如何在生产环境中访问 Doctrine 分析器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15090533/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com