1
votes

I am new to symfony and doctrine and would appreciate some help ...

I am connecting doctrine to an oracle 11g database.

I have created an table/entity which contains nullable date fields.

The fields are described in YAML thus

    metar_time:
        type: date
        nullable: true
        column: METAR_TIME
    taf_time:
        type: date
        nullable: true
        column: TAF_TIME
    ltaf_time:
        type: date
        nullable: true
        column: LTAF_TIME
    storage_date:
        type: date
        nullable: true
        column: STORAGE_DATE

The database schema reflects the status of the fields as nullable dates with a default value of null.

The issue that I am having is that I can not get doctrine to recognise that the database and meta description are in sync.

php app/console doctrine:schema:update --dump-sql
ALTER TABLE MET MODIFY (LTAF_TIME  DATE DEFAULT NULL, METAR_TIME  DATE DEFAULT NULL, STORAGE_DATE  DATE DEFAULT NULL, TAF_TIME  DATE DEFAULT NULL);


php app/console doctrine:schema:update --force
Updating database schema...
Database schema updated successfully! "1" queries were executed

Yet if I run the sql dump again the update is still outstanding.

I have cleared all the caches to rule that out as an issue.

Any suggestions welcome !

1

1 Answers

1
votes

This is known issue. Check Incorrect type mapping on Oracle Platform

Some ref:

The problem is that Oracle has a "DATE" type, which is actually a DATETIME. That is why we map it to Doctrine's Datetime type.

As a workaround, you can set this information yourself using: $conn->getDatabasePlatform()->registerDoctrineTypeMapping('date', 'date'); Be aware this is a global change for all columns. If you map DateTimes to a TIMESTAMP field you are good to go though.