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:
parent
ef9fda8707
commit
4a2fac7218
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user