Esempio n. 1
0
 /**
  * @param int $key
  * @param int $delta
  */
 private function shiftLeftRight($key, $delta)
 {
     $owner = $this->getOwner();
     foreach (array($this->leftAttribute, $this->rightAttribute) as $attribute) {
         $condition = $attribute . '>=' . $key;
         if ($this->hasManyRoots) {
             $condition .= ' AND ' . $this->rootAttribute . '=' . $owner->{$this->rootAttribute};
         }
         $query = sprintf('UPDATE %s SET %s=%s+%d WHERE %s', $this->owner->getSource(), $attribute, $attribute, $delta, $condition);
         $this->owner->getWriteConnection()->execute($query);
     }
 }