Code Duplication    Length = 29-29 lines in 2 locations

src/eXpansion/Bundle/LocalRecords/Model/Map/RecordTableMap.php 1 location

@@ 412-440 (lines=29) @@
409
     * @throws PropelException Any exceptions caught during processing will be
410
     *                         rethrown wrapped into a PropelException.
411
     */
412
     public static function doDelete($values, ConnectionInterface $con = null)
413
     {
414
        if (null === $con) {
415
            $con = Propel::getServiceContainer()->getWriteConnection(RecordTableMap::DATABASE_NAME);
416
        }
417
418
        if ($values instanceof Criteria) {
419
            // rename for clarity
420
            $criteria = $values;
421
        } elseif ($values instanceof \eXpansion\Bundle\LocalRecords\Model\Record) { // it's a model object
422
            // create criteria based on pk values
423
            $criteria = $values->buildPkeyCriteria();
424
        } else { // it's a primary key, or an array of pks
425
            $criteria = new Criteria(RecordTableMap::DATABASE_NAME);
426
            $criteria->add(RecordTableMap::COL_ID, (array) $values, Criteria::IN);
427
        }
428
429
        $query = RecordQuery::create()->mergeWith($criteria);
430
431
        if ($values instanceof Criteria) {
432
            RecordTableMap::clearInstancePool();
433
        } elseif (!is_object($values)) { // it's a primary key, or an array of pks
434
            foreach ((array) $values as $singleval) {
435
                RecordTableMap::removeInstanceFromPool($singleval);
436
            }
437
        }
438
439
        return $query->delete($con);
440
    }
441
442
    /**
443
     * Deletes all rows from the record table.

src/eXpansion/Framework/PlayersBundle/Model/Map/PlayerTableMap.php 1 location

@@ 384-412 (lines=29) @@
381
     * @throws PropelException Any exceptions caught during processing will be
382
     *                         rethrown wrapped into a PropelException.
383
     */
384
     public static function doDelete($values, ConnectionInterface $con = null)
385
     {
386
        if (null === $con) {
387
            $con = Propel::getServiceContainer()->getWriteConnection(PlayerTableMap::DATABASE_NAME);
388
        }
389
390
        if ($values instanceof Criteria) {
391
            // rename for clarity
392
            $criteria = $values;
393
        } elseif ($values instanceof \eXpansion\Framework\PlayersBundle\Model\Player) { // it's a model object
394
            // create criteria based on pk values
395
            $criteria = $values->buildPkeyCriteria();
396
        } else { // it's a primary key, or an array of pks
397
            $criteria = new Criteria(PlayerTableMap::DATABASE_NAME);
398
            $criteria->add(PlayerTableMap::COL_ID, (array) $values, Criteria::IN);
399
        }
400
401
        $query = PlayerQuery::create()->mergeWith($criteria);
402
403
        if ($values instanceof Criteria) {
404
            PlayerTableMap::clearInstancePool();
405
        } elseif (!is_object($values)) { // it's a primary key, or an array of pks
406
            foreach ((array) $values as $singleval) {
407
                PlayerTableMap::removeInstanceFromPool($singleval);
408
            }
409
        }
410
411
        return $query->delete($con);
412
    }
413
414
    /**
415
     * Deletes all rows from the player table.