Ticket #2169 (closed defect: fixed)

Opened 16 months ago

Last modified 14 months ago

Export creates upper case foreign key field names in Oracle schema

Reported by: pkw Owned by: jwage
Priority: minor Milestone: 1.0.11
Component: Import/Export Version: 1.0.7
Severity: abc Keywords:
Cc: Has Test: no
Status: Pending Core Response Has Patch: yes

Description

The field names in the yaml schema generated for Oracle are converted to lower case except when they appear in foreign keys. This causes failures in the generated classes when doing joins. The patch is to add strtolower to the lines near 115 in buildSchema in class Doctrine_Export_Schema

                $table['relations'][$relationKey]['local'] = strtolower($relationData['local']);
                $table['relations'][$relationKey]['foreign'] = strtolower($relationData['foreign']);

Attachments

doctrine_error.txt Download (5.0 KB) - added by pkw 15 months ago.
stack trace from failed join

Change History

Changed 16 months ago by pkw

  • component changed from Attributes to Import/Export

Changed 15 months ago by jwage

I don't think your change is the right change and you don't really give any good information in your ticket like the error that occurs, or anything else, etc...please try and be as descriptive as possible, include exception messages, stack traces, code to produce the problem and your changes should be submitted as a patch.

Changed 15 months ago by pkw

stack trace from failed join

Changed 15 months ago by pkw

I agree that change isn't the right fix, it's a kludge that makes Oracle work, probably at the expense of databases that obey case in names. I've reproduced the problem with a small example. The database has two tables PKW_PARENT and PKW_CHILD. The schema.yml is

PkwParent:
  tableName: PKW_PARENT
  columns:
    parent_id:
      type: integer(2147483647)
      primary: true
    name: string(20)
  relations:
    PkwChild:
      local: PARENT_ID
      foreign: PARENT_ID
      type: one

PkwChild:
  tableName: PKW_CHILD
  columns:
    child_id:
      type: integer(2147483647)
      primary: true
    child_name: string(20)
    parent_id: integer(2147483647)
  relations:
    PkwParent:
      local: PARENT_ID
      foreign: PARENT_ID
      type: many

This was built from the database using

symfony doctrine:build-schema

Note that the column names are lower case in the tables, but upper case in the relations, the kludge fixes this. When I attempt to join these tables I get

Unknown property PARENT_ID
    * at ()
      in SF_SYMFONY_LIB_DIR\plugins\sfDoctrinePlugin\lib\vendor\doctrine\Doctrine\Record.php line 944 ...

I've included the stack trace as an attachment. Now that I have a simple example I'll see if I can find a better fix. /peter

Changed 14 months ago by rouet

look at the ticket #2332

this problem is due to a bad definition or relations in the schema.yml file.

relation child->parent should be many to one and not the contrary.

JR

Changed 14 months ago by jwage

  • status changed from new to closed
  • resolution set to fixed
  • milestone changed from New to 1.0.11

I think this should be fixed now. It was fixed indirectly by another ticket.

Note: See TracTickets for help on using tickets.