protected function addRemoveFromList(&$script) { $useScope = $this->behavior->useScope(); $script .= "\n/**\n * Removes the current object from the list" . ($useScope ? ' (moves it to the null scope)' : '') . ".\n * The modifications are not persisted until the object is saved.\n *\n * @return \$this|{$this->objectClassName} the current object\n */\npublic function removeFromList()\n{"; if ($useScope) { $script .= "\n // check if object is already removed\n if (\$this->getScopeValue() === null) {\n throw new PropelException('Object is already removed (has null scope)');\n }\n\n // move the object to the end of null scope\n \$this->setScopeValue(null);"; } else { $script .= "\n // Keep the list modification query for the save() transaction\n \$this->sortableQueries[] = array(\n 'callable' => array('{$this->queryFullClassName}', 'sortableShiftRank'),\n 'arguments' => array(-1, \$this->{$this->getColumnGetter()}() + 1, null" . ($useScope ? ", \$this->getScopeValue()" : '') . ")\n );\n // remove the object from the list\n \$this->{$this->getColumnSetter('rank_column')}(null);\n "; } $script .= "\n\n return \$this;\n}\n"; }