/** * Exchange the rank of the object with the one passed as argument, and saves both objects * * @param AbsenceEleveType $object * @param PropelPDO $con optional connection * * @return AbsenceEleveType the current object * * @throws Exception if the database cannot execute the two updates */ public function swapWith($object, PropelPDO $con = null) { if ($con === null) { $con = Propel::getConnection(AbsenceEleveTypePeer::DATABASE_NAME); } $con->beginTransaction(); try { $oldRank = $this->getSortableRank(); $newRank = $object->getSortableRank(); $this->setSortableRank($newRank); $this->save($con); $object->setSortableRank($oldRank); $object->save($con); $con->commit(); return $this; } catch (Exception $e) { $con->rollback(); throw $e; } }