1

i am trying to save a date in a oracle database using Symfony and Doctrine, but it gives me an error:


DriverException An exception occurred while executing a query: ORA-01861

i tried to set it as a string, set it as a datetime and date, nothing seemed to work, the only solution i found was to set an oracle listener inside my services:

oracle.listener:
    class: Doctrine\DBAL\Event\Listeners\OracleSessionInit
    tags:
    - { name: doctrine.event_listener, event: postConnect }

the problem is, this listener is deprecated, soi should not be using it, but i don't seem to find a propper solution for it. my oracle database default for dates is: "DD-MON-RR".

i tried setting the entity field to date, datetime and time, i tried to pass a different string or object to the field setter, but nothing worked, the only thing that helped was that deprecated Listener

MT0
  • 143,790
  • 11
  • 59
  • 117
  • "my oracle database default for dates is: "DD-MON-RR"." See [Oracle's default date format](https://stackoverflow.com/a/50164234/1509264) for why this not technically correct (a `DATE` is a binary data type that always as a time component and has no format; what you are talking about is the default `NLS_DATE_FORMAT` session parameter which is used for implicit string-to-date and date-to-string conversions and by some client applications to format dates when displaying them). – MT0 Jun 15 '23 at 20:13
  • Please check https://github.com/doctrine/DoctrineBundle/issues/217 and yes listener is depreciated and you always can write own one :) – l3l0 Jun 18 '23 at 15:41

0 Answers0