示例#1
0
 public static function doDelete($values, PropelPDO $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(AlumnoPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
     }
     if ($values instanceof Criteria) {
         AlumnoPeer::clearInstancePool();
         $criteria = clone $values;
     } elseif ($values instanceof Alumno) {
         AlumnoPeer::removeInstanceFromPool($values);
         $criteria = $values->buildPkeyCriteria();
     } else {
         $criteria = new Criteria(self::DATABASE_NAME);
         $criteria->add(AlumnoPeer::ID, (array) $values, Criteria::IN);
         foreach ((array) $values as $singleval) {
             AlumnoPeer::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;
     }
 }