protected function addGetPrevious(&$script)
 {
     $useScope = $this->behavior->useScope();
     list($methodSignature, $paramsDoc, $buildScope, $buildScopeVars) = $this->behavior->generateScopePhp();
     $script .= "\n/**\n * Get the previous item in the list, i.e. the one for which rank is immediately lower\n *\n * @param     PropelPDO  \$con      optional connection\n *\n * @return    {$this->objectClassname}\n */\npublic function getPrevious(PropelPDO \$con = null)\n{";
     $script .= "\n\n    \$query = {$this->queryClassname}::create();\n";
     if ($useScope) {
         $methodSignature = str_replace(' = null', '', $methodSignature);
         $script .= "\n    \$scope = \$this->getScopeValue();\n    {$buildScopeVars}\n    \$query->filterByRank(\$this->{$this->getColumnGetter()}() - 1, {$methodSignature});\n";
     } else {
         $script .= "\n    \$query->filterByRank(\$this->{$this->getColumnGetter()}() - 1);\n";
     }
     $script .= "\n\n    return \$query->findOne(\$con);\n}\n";
 }
 protected function addGetMaxRank(&$script)
 {
     $this->builder->declareClasses('Propel');
     $useScope = $this->behavior->useScope();
     if ($useScope) {
         list($methodSignature, $paramsDoc, $buildScope) = $this->behavior->generateScopePhp();
     }
     $script .= "\n/**\n * Get the highest rank\n * ";
     if ($useScope) {
         $script .= "\n{$paramsDoc}\n";
     }
     $script .= "\n * @param     PropelPDO \$con optional connection\n * @return    integer highest position\n */\npublic function getMaxRank(" . ($useScope ? "{$methodSignature}, " : "") . "PropelPDO \$con = null)\n{\n    if (\$con === null) {\n        \$con = Propel::getConnection({$this->peerClassname}::DATABASE_NAME);\n    }\n    // shift the objects with a position lower than the one of object\n    \$this->addSelectColumn('MAX(' . {$this->peerClassname}::RANK_COL . ')');";
     if ($useScope) {
         $script .= "\n        {$buildScope}\n    {$this->peerClassname}::sortableApplyScopeCriteria(\$this, \$scope);";
     }
     $script .= "\n    \$stmt = \$this->doSelect(\$con);\n\n    return \$stmt->fetchColumn();\n}\n";
 }