| @@ 429-467 (lines=39) @@ | ||
| 426 | * @throws PropelException Any exceptions caught during processing will be |
|
| 427 | * rethrown wrapped into a PropelException. |
|
| 428 | */ |
|
| 429 | public static function doDelete($values, ConnectionInterface $con = null) |
|
| 430 | { |
|
| 431 | if (null === $con) { |
|
| 432 | $con = Propel::getServiceContainer()->getWriteConnection(BannerImageI18nTableMap::DATABASE_NAME); |
|
| 433 | } |
|
| 434 | ||
| 435 | if ($values instanceof Criteria) { |
|
| 436 | // rename for clarity |
|
| 437 | $criteria = $values; |
|
| 438 | } elseif ($values instanceof \xbanners\models\BannerImageI18n) { // it's a model object |
|
| 439 | // create criteria based on pk values |
|
| 440 | $criteria = $values->buildPkeyCriteria(); |
|
| 441 | } else { // it's a primary key, or an array of pks |
|
| 442 | $criteria = new Criteria(BannerImageI18nTableMap::DATABASE_NAME); |
|
| 443 | // primary key is composite; we therefore, expect |
|
| 444 | // the primary key passed to be an array of pkey values |
|
| 445 | if (count($values) == count($values, COUNT_RECURSIVE)) { |
|
| 446 | // array is not multi-dimensional |
|
| 447 | $values = array($values); |
|
| 448 | } |
|
| 449 | foreach ($values as $value) { |
|
| 450 | $criterion = $criteria->getNewCriterion(BannerImageI18nTableMap::COL_ID, $value[0]); |
|
| 451 | $criterion->addAnd($criteria->getNewCriterion(BannerImageI18nTableMap::COL_LOCALE, $value[1])); |
|
| 452 | $criteria->addOr($criterion); |
|
| 453 | } |
|
| 454 | } |
|
| 455 | ||
| 456 | $query = BannerImageI18nQuery::create()->mergeWith($criteria); |
|
| 457 | ||
| 458 | if ($values instanceof Criteria) { |
|
| 459 | BannerImageI18nTableMap::clearInstancePool(); |
|
| 460 | } elseif (!is_object($values)) { // it's a primary key, or an array of pks |
|
| 461 | foreach ((array) $values as $singleval) { |
|
| 462 | BannerImageI18nTableMap::removeInstanceFromPool($singleval); |
|
| 463 | } |
|
| 464 | } |
|
| 465 | ||
| 466 | return $query->delete($con); |
|
| 467 | } |
|
| 468 | ||
| 469 | /** |
|
| 470 | * Deletes all rows from the banner_image_i18n table. |
|
| @@ 405-443 (lines=39) @@ | ||
| 402 | * @throws PropelException Any exceptions caught during processing will be |
|
| 403 | * rethrown wrapped into a PropelException. |
|
| 404 | */ |
|
| 405 | public static function doDelete($values, ConnectionInterface $con = null) |
|
| 406 | { |
|
| 407 | if (null === $con) { |
|
| 408 | $con = Propel::getServiceContainer()->getWriteConnection(BannersI18nTableMap::DATABASE_NAME); |
|
| 409 | } |
|
| 410 | ||
| 411 | if ($values instanceof Criteria) { |
|
| 412 | // rename for clarity |
|
| 413 | $criteria = $values; |
|
| 414 | } elseif ($values instanceof \xbanners\models\BannersI18n) { // it's a model object |
|
| 415 | // create criteria based on pk values |
|
| 416 | $criteria = $values->buildPkeyCriteria(); |
|
| 417 | } else { // it's a primary key, or an array of pks |
|
| 418 | $criteria = new Criteria(BannersI18nTableMap::DATABASE_NAME); |
|
| 419 | // primary key is composite; we therefore, expect |
|
| 420 | // the primary key passed to be an array of pkey values |
|
| 421 | if (count($values) == count($values, COUNT_RECURSIVE)) { |
|
| 422 | // array is not multi-dimensional |
|
| 423 | $values = array($values); |
|
| 424 | } |
|
| 425 | foreach ($values as $value) { |
|
| 426 | $criterion = $criteria->getNewCriterion(BannersI18nTableMap::COL_ID, $value[0]); |
|
| 427 | $criterion->addAnd($criteria->getNewCriterion(BannersI18nTableMap::COL_LOCALE, $value[1])); |
|
| 428 | $criteria->addOr($criterion); |
|
| 429 | } |
|
| 430 | } |
|
| 431 | ||
| 432 | $query = BannersI18nQuery::create()->mergeWith($criteria); |
|
| 433 | ||
| 434 | if ($values instanceof Criteria) { |
|
| 435 | BannersI18nTableMap::clearInstancePool(); |
|
| 436 | } elseif (!is_object($values)) { // it's a primary key, or an array of pks |
|
| 437 | foreach ((array) $values as $singleval) { |
|
| 438 | BannersI18nTableMap::removeInstanceFromPool($singleval); |
|
| 439 | } |
|
| 440 | } |
|
| 441 | ||
| 442 | return $query->delete($con); |
|
| 443 | } |
|
| 444 | ||
| 445 | /** |
|
| 446 | * Deletes all rows from the banners_i18n table. |
|