Example #1
0
 public static function doDelete($values, PropelPDO $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(DivisionPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
     }
     if ($values instanceof Criteria) {
         DivisionPeer::clearInstancePool();
         $criteria = clone $values;
     } elseif ($values instanceof Division) {
         DivisionPeer::removeInstanceFromPool($values);
         $criteria = $values->buildPkeyCriteria();
     } else {
         $criteria = new Criteria(self::DATABASE_NAME);
         $criteria->add(DivisionPeer::ID, (array) $values, Criteria::IN);
         foreach ((array) $values as $singleval) {
             DivisionPeer::removeInstanceFromPool($singleval);
         }
     }
     $criteria->setDbName(self::DATABASE_NAME);
     $affectedRows = 0;
     try {
         $con->beginTransaction();
         $affectedRows += BasePeer::doDelete($criteria, $con);
         $con->commit();
         return $affectedRows;
     } catch (PropelException $e) {
         $con->rollBack();
         throw $e;
     }
 }