Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Invalid
-
Affects Version/s: 1.2.0-ALPHA1, 1.2.0-ALPHA2, 1.2.0-ALPHA3, 1.2.0-BETA1, 1.2.0-BETA2
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
Description
Here is the relevant slice of my schema:
Contact:
tableName: contact
columns:
id:
type: integer(4)
unsigned: true
primary: true
type_code as typeCode:
type: enum
values: [COMPANY, PERSON]
notnull: true
Company:
inheritance:
extends: Contact
type: column_aggregation
keyField: type_code
keyValue: COMPANY
columns:
...
Here is the generated base class:
abstract class BaseContact extends sfDoctrineRecord { public function setTableDefinition() { $this->setTableName('contact'); ... $this->hasColumn('type_code as typeCode', 'enum', null, array( 'type' => 'enum', 'values' => array( 0 => 'COMPANY', 1 => 'PERSON', ), 'notnull' => true, )); $this->hasColumn('type_code', 'string', 255, array( 'type' => 'string', 'length' => 255, )); ...
It is simple what is happening. You have the column key "type_code as typeCode" so that is the key of the array in the yaml. You say the keyField is "type_code" so it checks if "type_code" is a key in the array of columns for Contact. I would setup your schema like the following.
Contact: tableName: contact columns: id: type: integer(4) unsigned: true primary: true typeCode: name: type_code as typeCode type: enum values: [COMPANY, PERSON] notnull: true Company: inheritance: extends: Contact type: column_aggregation keyField: typeCode keyValue: COMPANY columns: