Ticket #1713 (closed defect: fixed)
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
Change History
Note: See TracTickets for help on using tickets.Download in other formats: