1
0
mirror of synced 2024-12-13 14:56:01 +03:00

Fixed a bug in the nestedset implementation. When using single table inheritance all node instances need to use the same tree object. previously every subclass created it's own tree object which resulted in strange behaviour.

This commit is contained in:
romanb 2007-09-04 12:52:23 +00:00
parent ef9fda8707
commit 4a2fac7218
2 changed files with 17 additions and 2 deletions

View File

@ -68,7 +68,22 @@ class Doctrine_Node implements IteratorAggregate
{
$this->record = $record;
$this->options = $options;
$this->_tree = $this->record->getTable()->getTree();
// Make sure that the tree object of the root component is used in the case
// of column aggregation inheritance.
$class = $record->getTable()->getComponentName();
$table = $record->getTable();
if ($table->getOption('inheritanceMap')) {
$subclasses = $table->getOption('subclasses');
while (in_array($class, $subclasses)) {
$class = get_parent_class($class);
}
}
if ($class != $table->getComponentName()) {
$this->_tree = $table->getConnection()->getTable($class)->getTree();
} else {
$this->_tree = $table->getTree();
}
}
/**

View File

@ -399,7 +399,7 @@ if (PHP_SAPI === 'cli') {
$reporter = new MyReporter();
}
$argv = $_SERVER['argv'];
$argv = isset($_SERVER['argv']) ? $_SERVER['argv'] : array();
array_shift($argv);
$options = parseOptions($argv);