parent
e990c9e4f8
commit
bc24aafd87
@ -590,18 +590,19 @@ class Doctrine_Node_NestedSet extends Doctrine_Node implements Doctrine_Node_Int
|
|||||||
// TODO: Wrap in transaction
|
// TODO: Wrap in transaction
|
||||||
|
|
||||||
// shift left columns
|
// shift left columns
|
||||||
$qLeft = $qLeft->update($this->record->getTable()->getComponentName())
|
$componentName = $this->record->getTable()->getComponentName();
|
||||||
->set('lft', 'lft + ' . $delta)
|
$qLeft = $qLeft->update($componentName)
|
||||||
->where('lft >= ?', $first);
|
->set($componentName . '.lft', 'lft + ' . $delta)
|
||||||
|
->where($componentName . '.lft >= ?', $first);
|
||||||
|
|
||||||
$qLeft = $this->record->getTable()->getTree()->returnQueryWithRootId($qLeft, $rootId);
|
$qLeft = $this->record->getTable()->getTree()->returnQueryWithRootId($qLeft, $rootId);
|
||||||
|
|
||||||
$resultLeft = $qLeft->execute();
|
$resultLeft = $qLeft->execute();
|
||||||
|
|
||||||
// shift right columns
|
// shift right columns
|
||||||
$resultRight = $qRight->update($this->record->getTable()->getComponentName())
|
$resultRight = $qRight->update($componentName)
|
||||||
->set('rgt', 'rgt + ' . $delta)
|
->set($componentName . '.rgt', 'rgt + ' . $delta)
|
||||||
->where('rgt >= ?', $first);
|
->where($componentName . '.rgt >= ?', $first);
|
||||||
|
|
||||||
$qRight = $this->record->getTable()->getTree()->returnQueryWithRootId($qRight, $rootId);
|
$qRight = $this->record->getTable()->getTree()->returnQueryWithRootId($qRight, $rootId);
|
||||||
|
|
||||||
@ -624,18 +625,19 @@ class Doctrine_Node_NestedSet extends Doctrine_Node implements Doctrine_Node_Int
|
|||||||
// TODO : Wrap in transaction
|
// TODO : Wrap in transaction
|
||||||
|
|
||||||
// shift left column values
|
// shift left column values
|
||||||
$qLeft = $qLeft->update($this->record->getTable()->getComponentName())
|
$componentName = $this->record->getTable()->getComponentName();
|
||||||
->set('lft', 'lft + ' . $delta)
|
$qLeft = $qLeft->update($componentName)
|
||||||
->where('lft >= ? AND lft <= ?', array($first, $last));
|
->set($componentName . '.lft', 'lft + ' . $delta)
|
||||||
|
->where($componentName . '.lft >= ? AND ' . $componentName . '.lft <= ?', array($first, $last));
|
||||||
|
|
||||||
$qLeft = $this->record->getTable()->getTree()->returnQueryWithRootId($qLeft, $rootId);
|
$qLeft = $this->record->getTable()->getTree()->returnQueryWithRootId($qLeft, $rootId);
|
||||||
|
|
||||||
$resultLeft = $qLeft->execute();
|
$resultLeft = $qLeft->execute();
|
||||||
|
|
||||||
// shift right column values
|
// shift right column values
|
||||||
$qRight = $qRight->update($this->record->getTable()->getComponentName())
|
$qRight = $qRight->update($componentName)
|
||||||
->set('rgt', 'rgt + ' . $delta)
|
->set($componentName . '.rgt', 'rgt + ' . $delta)
|
||||||
->where('rgt >= ? AND rgt <= ?', array($first, $last));
|
->where($componentName . '.rgt >= ? AND ' . $componentName . '.rgt <= ?', array($first, $last));
|
||||||
|
|
||||||
$qRight = $this->record->getTable()->getTree()->returnQueryWithRootId($qRight, $rootId);
|
$qRight = $this->record->getTable()->getTree()->returnQueryWithRootId($qRight, $rootId);
|
||||||
|
|
||||||
@ -691,8 +693,9 @@ class Doctrine_Node_NestedSet extends Doctrine_Node implements Doctrine_Node_Int
|
|||||||
{
|
{
|
||||||
if(!isset($this->level))
|
if(!isset($this->level))
|
||||||
{
|
{
|
||||||
|
$componentName = $this->record->getTable()->getComponentName();
|
||||||
$q = $this->record->getTable()->createQuery();
|
$q = $this->record->getTable()->createQuery();
|
||||||
$q = $q->where('lft < ? AND rgt > ?', array($this->getLeftValue(), $this->getRightValue()));
|
$q = $q->where($componentName . '.lft < ? AND ' . $componentName . '.rgt > ?', array($this->getLeftValue(), $this->getRightValue()));
|
||||||
|
|
||||||
$q = $this->record->getTable()->getTree()->returnQueryWithRootId($q, $this->getRootValue());
|
$q = $this->record->getTable()->getTree()->returnQueryWithRootId($q, $this->getRootValue());
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user