Hi,

On 20 November 2014 14:34, <[email protected]> wrote:

> I am developing an application with symphony2 (ORM Doctrine 2) with an
> Oracle database.
>
> I create an entity with annotation to map the property to the database
> column and I am having a problem
>
> The annotation is like this:
>
> /**
>  * @var \DateTime
>  *
>  * @ORM\Column(name="UPDATEAT", type="datetime", nullable=true)
>  */
> private $updateAt = "CURRENT_TIMESTAMP";
>
>
Please don't assign a string to `$updateAt`. Instead, assign a `new
DateTime()` instance in your constructor.

> Then I run the command
>
>
> php.exe app/console doctrine:schema:update --force
>
> And it generates the column as TIMESTAMP
>
> When I am trying to get the value of that column I get the error:
> “Could not convert database value "18/11/14 19:53:50" to Doctrine Type
> datetime. Expected format: Y-m-d H:i:s ”
>
> Could anyone help me? I don't know what to do. I search it, but didn't
> come to any solution
>

Please see
http://doctrine-dbal.readthedocs.org/en/latest/reference/events.html#postconnect-event

You need the OracleSessionInit listener, as OracleDB has a different date
format from the one expected by Doctrine.

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/

-- 
You received this message because you are subscribed to the Google Groups 
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to