wheregroup/doctrine-dbal-shims

Doctrine DBAL / ORM 便利的多连接混合设置

v1.2.0 2024-05-15 08:55 UTC

This package is auto-updated.

Last update: 2024-09-15 09:36:25 UTC


README

包含一个事件订阅者,它自动设置DBAL和Doctrine ORM正常运行所需的Oracle会话变量(日期格式等)。

与DBAL默认实现不同,此功能可以全局添加,并且仅检查/操作Oracle DBAL连接。所有其他连接类型将完全不被干扰。

这使得在混合多连接设置中使用它更容易,并且确实在没有任何Oracle连接的情况下安全使用。

用法

安装了 doctrine/dbal-bundle 后,您可以将包含的 AddOracleSessionInitPass 注册到您的Symfony容器构建中,或使用PassIndex来为您完成此操作。

# Bundle class
public function build(ContainerBuilder $container)
{
    <...>
    PassIndex::autoRegisterAll($container);
    <...>
}
# Kernel class
public function buildContainer()
{
    $container = parent::buildContainer();
    <...>
    PassIndex::autoRegisterAll($container);
    <...>
    return $container;
}

独立DBAL

没有Symfony和Doctrine包,编译器传递不会工作。

需要在某些方式下将OnDemandOracleSessionInit订阅者实例添加到连接的事件管理器中才能执行任何操作。