protected function addShiftLevel(&$script) { $objectClassName = $this->objectClassName; $useScope = $this->behavior->useScope(); $tableMapClassName = $this->builder->getTableMapClass(); $this->builder->declareClass('Propel\\Runtime\\Map\\TableMap'); $script .= "\n/**\n * Adds \$delta to level for nodes having left value >= \$first and right value <= \$last.\n * '\$delta' can also be negative.\n *\n * @param int \$delta Value to be shifted by, can be negative\n * @param int \$first First node to be shifted\n * @param int \$last Last node to be shifted"; if ($useScope) { $script .= "\n * @param int \$scope Scope to use for the shift"; } $script .= "\n * @param ConnectionInterface \$con Connection to use.\n */\nstatic public function shiftLevel(\$delta, \$first, \$last" . ($useScope ? ", \$scope = null" : "") . ", ConnectionInterface \$con = null)\n{\n if (\$con === null) {\n \$con = Propel::getServiceContainer()->getWriteConnection({$tableMapClassName}::DATABASE_NAME);\n }\n\n \$whereCriteria = new Criteria({$tableMapClassName}::DATABASE_NAME);\n \$whereCriteria->add({$objectClassName}::LEFT_COL, \$first, Criteria::GREATER_EQUAL);\n \$whereCriteria->add({$objectClassName}::RIGHT_COL, \$last, Criteria::LESS_EQUAL);"; if ($useScope) { $script .= "\n \$whereCriteria->add({$objectClassName}::SCOPE_COL, \$scope, Criteria::EQUAL);"; } $script .= "\n\n \$valuesCriteria = new Criteria({$tableMapClassName}::DATABASE_NAME);\n \$valuesCriteria->add({$objectClassName}::LEVEL_COL, array('raw' => {$objectClassName}::LEVEL_COL . ' + ?', 'value' => \$delta), Criteria::CUSTOM_EQUAL);\n\n \$whereCriteria->doUpdate(\$valuesCriteria, \$con);\n}\n"; }