Ticket #1713 (closed defect: fixed)

Opened 7 months ago

Last modified 7 months ago

Inheritance broken with Doctrine-1.0.4 release

Reported by: vadik56 Owned by: jwage
Priority: blocker Milestone: 1.0.6
Component: Query/Hydration Version: 1.0.4
Severity: Keywords: subclass, inheritance
Cc: Has Test: yes
Status: Pending Core Response Has Patch: no

Description (last modified by vadik56) (diff)

When type column has an alias then subclass is not properly returned in RecordDriver?.php line 158 through 167:

foreach ($subclasses as $subclass) {

$table = Doctrine::getTable($subclass); $inheritanceMap = $table->getOption('inheritanceMap'); list($key, $value) = each($inheritanceMap);

if ( ! isset($data[$key]) $data[$key] != $value) {

continue;

} else {

return $table->getComponentName();

}

}

$data array would contain alias as key and $inheritanceMap would contain column name so it would never find appropriate child class.

looks like it is due to new code in Record/Abstract.php:

public function setSubclasses($map)

{

if (isset($map[get_class($this)])) {

// fix for #1621 $mapFieldNames = $map[get_class($this)]; $mapColumnNames = array();

foreach ($mapFieldNames as $fieldName => $val) {

$mapColumnNames[$this->getTable()->getColumnName($fieldName)] = $val;

}

$this->_table->setOption('inheritanceMap', $mapColumnNames); return;

} $this->_table->setOption('subclasses', array_keys($map));

}

Inheritance is broken even if there is no alias and column name is specified using upper case. The only way to get it working now is to use column definition using lower case: $this->hasColumn('php_type', 'integer', 11, array ());

Attachments

1713TestCase.php (1.2 KB) - added by vadik56 7 months ago.

Change History

Changed 7 months ago by vadik56

  • has_test set

Changed 7 months ago by vadik56

  • description modified (diff)
  • summary changed from Doctrine-1.0.4 fails to return appropriate subclass when type column is aliased to Inheritance broken with Doctrine-1.0.4 release

Changed 7 months ago by vadik56

Changed 7 months ago by vadik56

  • owner changed from romanb to Jonathan.Wage
  • status changed from new to assigned

Changed 7 months ago by vadik56

  • owner changed from Jonathan.Wage to jwage

Changed 7 months ago by jwage

  • status changed from assigned to closed
  • resolution set to fixed

(In [5298]) [1.0, 1.1] Fixes issue with inheritance type column when it is aliased (closes #1713)

Changed 7 months ago by jwage

  • milestone changed from 1.0.5 to 1.0.6
Note: See TracTickets for help on using tickets.