在 Symfony/Doctrine DBAL 中捕获预执行事件
Capturing Pre-execute Event in Symfony/Doctrine DBAL
我正在寻找一种在 Doctrine/Symfony 发送到 Postgres 之前插入和 modify/wrap 查询的方法。我一直在查看 Symfony 和 Doctrine 的标准事件(here and here 是我发现的),但似乎没有任何通用的 "before execute query" 事件。
这可能是丢失cause/even吗?
谢谢
由于配置连接时的 wrapper_class 参数,您是否尝试过使用包装器 class?
See here for more info about Doctrine DBAL's configuration
基本上,它允许您实现自定义 Connection class。你可以做的是创建一个自定义的 Connection class 继承自原始的 (\Doctrine\DBAL\Connection) 并覆盖 executeQuery() 方法。在那里,您可以使用自己的事件管理实现来引发事件或使用内置的 EventManager.
我正在寻找一种在 Doctrine/Symfony 发送到 Postgres 之前插入和 modify/wrap 查询的方法。我一直在查看 Symfony 和 Doctrine 的标准事件(here and here 是我发现的),但似乎没有任何通用的 "before execute query" 事件。
这可能是丢失cause/even吗?
谢谢
由于配置连接时的 wrapper_class 参数,您是否尝试过使用包装器 class?
See here for more info about Doctrine DBAL's configuration
基本上,它允许您实现自定义 Connection class。你可以做的是创建一个自定义的 Connection class 继承自原始的 (\Doctrine\DBAL\Connection) 并覆盖 executeQuery() 方法。在那里,您可以使用自己的事件管理实现来引发事件或使用内置的 EventManager.