Code Duplication    Length = 26-26 lines in 2 locations

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

@@ 462-487 (lines=26) @@
459
     * @throws PropelException Any exceptions caught during processing will be
460
     *                         rethrown wrapped into a PropelException.
461
     */
462
    public static function doInsert($criteria, ConnectionInterface $con = null)
463
    {
464
        if (null === $con) {
465
            $con = Propel::getServiceContainer()->getWriteConnection(RecordTableMap::DATABASE_NAME);
466
        }
467
468
        if ($criteria instanceof Criteria) {
469
            $criteria = clone $criteria; // rename for clarity
470
        } else {
471
            $criteria = $criteria->buildCriteria(); // build Criteria from Record object
472
        }
473
474
        if ($criteria->containsKey(RecordTableMap::COL_ID) && $criteria->keyContainsValue(RecordTableMap::COL_ID) ) {
475
            throw new PropelException('Cannot insert a value for auto-increment primary key ('.RecordTableMap::COL_ID.')');
476
        }
477
478
479
        // Set the correct dbName
480
        $query = RecordQuery::create()->mergeWith($criteria);
481
482
        // use transaction because $criteria could contain info
483
        // for more than one table (I guess, conceivably)
484
        return $con->transaction(function () use ($con, $query) {
485
            return $query->doInsert($con);
486
        });
487
    }
488
489
} // RecordTableMap
490
// This is the static code needed to register the TableMap for this table with the main Propel class.

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

@@ 434-459 (lines=26) @@
431
     * @throws PropelException Any exceptions caught during processing will be
432
     *                         rethrown wrapped into a PropelException.
433
     */
434
    public static function doInsert($criteria, ConnectionInterface $con = null)
435
    {
436
        if (null === $con) {
437
            $con = Propel::getServiceContainer()->getWriteConnection(PlayerTableMap::DATABASE_NAME);
438
        }
439
440
        if ($criteria instanceof Criteria) {
441
            $criteria = clone $criteria; // rename for clarity
442
        } else {
443
            $criteria = $criteria->buildCriteria(); // build Criteria from Player object
444
        }
445
446
        if ($criteria->containsKey(PlayerTableMap::COL_ID) && $criteria->keyContainsValue(PlayerTableMap::COL_ID) ) {
447
            throw new PropelException('Cannot insert a value for auto-increment primary key ('.PlayerTableMap::COL_ID.')');
448
        }
449
450
451
        // Set the correct dbName
452
        $query = PlayerQuery::create()->mergeWith($criteria);
453
454
        // use transaction because $criteria could contain info
455
        // for more than one table (I guess, conceivably)
456
        return $con->transaction(function () use ($con, $query) {
457
            return $query->doInsert($con);
458
        });
459
    }
460
461
} // PlayerTableMap
462
// This is the static code needed to register the TableMap for this table with the main Propel class.