original_string: public function moveToRank($newRank, ConnectionInterface $con = null)
      {
          if ($this->isNew()) {
              throw new PropelException('New objects cannot be moved. Please use insertAtRank() instead');
          }
          if (null === $con) {
              $con = Propel::getServiceContainer()->getWriteConnection(CustomerGroupTableMap::DATABASE_NAME);
          }
          if ($newRank < 1 || $newRank > ChildCustomerGroupQuery::create()->getMaxRankArray($con)) {
              throw new PropelException('Invalid rank ' . $newRank);
          }
  
          $oldRank = $this->getPosition();
          if ($oldRank == $newRank) {
              return $this;
          }
  
          $con->beginTransaction();
          try {
              // shift the objects between the old and the new rank
              $delta = ($oldRank < $newRank) ? -1 : 1;
              ChildCustomerGroupQuery::sortableShiftRank($delta, min($oldRank, $newRank), max($oldRank, $newRank), $con);
  
              // move the object to its new rank
              $this->setPosition($newRank);
              $this->save($con);
  
              $con->commit();
  
              return $this;
          } catch (Exception $e) {
              $con->rollback();
              throw $e;
          }
      }
code: public function moveToRank($newRank, ConnectionInterface $con = null)
      {
          if ($this->isNew()) {
              throw new PropelException('New objects cannot be moved. Please use insertAtRank() instead');
          }
          if (null === $con) {
              $con = Propel::getServiceContainer()->getWriteConnection(CustomerGroupTableMap::DATABASE_NAME);
          }
          if ($newRank < 1 || $newRank > ChildCustomerGroupQuery::create()->getMaxRankArray($con)) {
              throw new PropelException('Invalid rank ' . $newRank);
          }
  
          $oldRank = $this->getPosition();
          if ($oldRank == $newRank) {
              return $this;
          }
  
          $con->beginTransaction();
          try {
              // shift the objects between the old and the new rank
              $delta = ($oldRank < $newRank) ? -1 : 1;
              ChildCustomerGroupQuery::sortableShiftRank($delta, min($oldRank, $newRank), max($oldRank, $newRank), $con);
  
              // move the object to its new rank
              $this->setPosition($newRank);
              $this->save($con);
  
              $con->commit();
  
              return $this;
          } catch (Exception $e) {
              $con->rollback();
              throw $e;
          }
      }
code_tokens: public function moveToRank ( $ newRank , ConnectionInterface $ con = null ) { if ( $ this -> isNew ( ) ) { throw new PropelException ( 'New objects cannot be moved. Please use insertAtRank() instead' ) ; } if ( null === $ con ) { $ con = Propel :: getServiceContainer ( ) -> getWriteConnection ( CustomerGroupTableMap :: DATABASE_NAME ) ; } if ( $ newRank < 1 || $ newRank > ChildCustomerGroupQuery :: create ( ) -> getMaxRankArray ( $ con ) ) { throw new PropelException ( 'Invalid rank ' . $ newRank ) ; } $ oldRank = $ this -> getPosition ( ) ; if ( $ oldRank == $ newRank ) { return $ this ; } $ con -> beginTransaction ( ) ; try { // shift the objects between the old and the new rank $ delta = ( $ oldRank < $ newRank ) ? - 1 : 1 ; ChildCustomerGroupQuery :: sortableShiftRank ( $ delta , min ( $ oldRank , $ newRank ) , max ( $ oldRank , $ newRank ) , $ con ) ; // move the object to its new rank $ this -> setPosition ( $ newRank ) ; $ this -> save ( $ con ) ; $ con -> commit ( ) ; return $ this ; } catch ( Exception $ e ) { $ con -> rollback ( ) ; throw $ e ; } }
docstring: Move the object to a new rank, and shifts the rank
  Of the objects inbetween the old and new rank accordingly
  
  @param     integer   $newRank rank value
  @param     ConnectionInterface $con optional connection
  
  @return    ChildCustomerGroup the current object
  
  @throws    PropelException
docstring_tokens: Move the object to a new rank and shifts the rank Of the objects inbetween the old and new rank accordingly