如何用Symfony2使用Doctrine OracleSessionInit监听器? [英] How to use Doctrine OracleSessionInit listener with Symfony2?
问题描述
我正在使用oracle,我收到这个错误:
无法转换数据库值17-NOV-11 12.17.33 AMto Doctrine类型datetime。预期格式:Ymd H:i:s
此外,我无法创建新行,因为oracle对datetime格式的投诉。 p>
我知道mysql datetime格式和oracle一样是不同的。
我明白你可以用symfony 2:
http: //symfony.com/doc/current/cookbook/doctrine/event_listeners_subscribers.html
而且,创建了一个修改此问题的教条侦听器: / p>
Doctrine / DBAL / Event / Listeners / OracleSessionInit.php
问题是你的轮到symfony 2。
好吧,这次我会回答自己。
您必须使用事件代码将其添加为服务。
app / config / config.yml
服务:
my.listener:
class:Doctrine\DBAL\Event\Listeners\OracleSessionInit
标签:
- {name:doctrine.event_listener,event:postConnect}
my.listener是侦听器的任意名称。
I am using oracle and I am recieving this error:
Could not convert database value "17-NOV-11 12.17.33 AM" to Doctrine Type datetime. Expected format: Y-m-d H:i:s
Also I can´t create new rows because oracle complaints about the datetime format.
I know that mysql datetime format and oracle one are different.
I understand that you can use doctrine listeners with symfony 2:
http://symfony.com/doc/current/cookbook/doctrine/event_listeners_subscribers.html
And, there´s a doctrine listener created to fix this issue:
Doctrine/DBAL/Event/Listeners/OracleSessionInit.php
The question is how Exactly your turn it on in symfony 2.
Well It appears I will answer myself this time.
You have to add it as a service using the event tag.
app/config/config.yml
services:
my.listener:
class: Doctrine\DBAL\Event\Listeners\OracleSessionInit
tags:
- { name: doctrine.event_listener, event: postConnect }
my.listener is an arbitrary name for the listener.
这篇关于如何用Symfony2使用Doctrine OracleSessionInit监听器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!