| @@ 907-934 (lines=28) @@ | ||
| 904 | * @throws PropelException Any exceptions caught during processing will be |
|
| 905 | * rethrown wrapped into a PropelException. |
|
| 906 | */ |
|
| 907 | public function delete(ConnectionInterface $con = null) |
|
| 908 | { |
|
| 909 | if (null === $con) { |
|
| 910 | $con = Propel::getServiceContainer()->getWriteConnection(BannerImageTableMap::DATABASE_NAME); |
|
| 911 | } |
|
| 912 | ||
| 913 | $criteria = $this; |
|
| 914 | ||
| 915 | // Set the correct dbName |
|
| 916 | $criteria->setDbName(BannerImageTableMap::DATABASE_NAME); |
|
| 917 | ||
| 918 | // use transaction because $criteria could contain info |
|
| 919 | // for more than one table or we could emulating ON DELETE CASCADE, etc. |
|
| 920 | return $con->transaction(function () use ($con, $criteria) { |
|
| 921 | $affectedRows = 0; // initialize var to track total num of affected rows |
|
| 922 | ||
| 923 | // cloning the Criteria in case it's modified by doSelect() or doSelectStmt() |
|
| 924 | $c = clone $criteria; |
|
| 925 | $affectedRows += $c->doOnDeleteCascade($con); |
|
| 926 | ||
| 927 | BannerImageTableMap::removeInstanceFromPool($criteria); |
|
| 928 | ||
| 929 | $affectedRows += ModelCriteria::delete($con); |
|
| 930 | BannerImageTableMap::clearRelatedInstancePool(); |
|
| 931 | ||
| 932 | return $affectedRows; |
|
| 933 | }); |
|
| 934 | } |
|
| 935 | ||
| 936 | /** |
|
| 937 | * This is a method for emulating ON DELETE CASCADE for DBs that don't support this |
|
| @@ 694-721 (lines=28) @@ | ||
| 691 | * @throws PropelException Any exceptions caught during processing will be |
|
| 692 | * rethrown wrapped into a PropelException. |
|
| 693 | */ |
|
| 694 | public function delete(ConnectionInterface $con = null) |
|
| 695 | { |
|
| 696 | if (null === $con) { |
|
| 697 | $con = Propel::getServiceContainer()->getWriteConnection(BannersTableMap::DATABASE_NAME); |
|
| 698 | } |
|
| 699 | ||
| 700 | $criteria = $this; |
|
| 701 | ||
| 702 | // Set the correct dbName |
|
| 703 | $criteria->setDbName(BannersTableMap::DATABASE_NAME); |
|
| 704 | ||
| 705 | // use transaction because $criteria could contain info |
|
| 706 | // for more than one table or we could emulating ON DELETE CASCADE, etc. |
|
| 707 | return $con->transaction(function () use ($con, $criteria) { |
|
| 708 | $affectedRows = 0; // initialize var to track total num of affected rows |
|
| 709 | ||
| 710 | // cloning the Criteria in case it's modified by doSelect() or doSelectStmt() |
|
| 711 | $c = clone $criteria; |
|
| 712 | $affectedRows += $c->doOnDeleteCascade($con); |
|
| 713 | ||
| 714 | BannersTableMap::removeInstanceFromPool($criteria); |
|
| 715 | ||
| 716 | $affectedRows += ModelCriteria::delete($con); |
|
| 717 | BannersTableMap::clearRelatedInstancePool(); |
|
| 718 | ||
| 719 | return $affectedRows; |
|
| 720 | }); |
|
| 721 | } |
|
| 722 | ||
| 723 | /** |
|
| 724 | * This is a method for emulating ON DELETE CASCADE for DBs that don't support this |
|