Commit 4a2fac72 authored by romanb's avatar romanb

Fixed a bug in the nestedset implementation. When using single table...

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.
parent ef9fda87
......@@ -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();
}
}
/**
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment