Code Duplication    Length = 26-26 lines in 2 locations

app/Models/Task/Map/TaskTableMap.php 1 location

@@ 386-411 (lines=26) @@
383
     * @throws PropelException Any exceptions caught during processing will be
384
     *                         rethrown wrapped into a PropelException.
385
     */
386
    public static function doInsert($criteria, ConnectionInterface $con = null)
387
    {
388
        if (null === $con) {
389
            $con = Propel::getServiceContainer()->getWriteConnection(TaskTableMap::DATABASE_NAME);
390
        }
391
392
        if ($criteria instanceof Criteria) {
393
            $criteria = clone $criteria; // rename for clarity
394
        } else {
395
            $criteria = $criteria->buildCriteria(); // build Criteria from Task object
396
        }
397
398
        if ($criteria->containsKey(TaskTableMap::COL_ID) && $criteria->keyContainsValue(TaskTableMap::COL_ID) ) {
399
            throw new PropelException('Cannot insert a value for auto-increment primary key ('.TaskTableMap::COL_ID.')');
400
        }
401
402
403
        // Set the correct dbName
404
        $query = TaskQuery::create()->mergeWith($criteria);
405
406
        // use transaction because $criteria could contain info
407
        // for more than one table (I guess, conceivably)
408
        return $con->transaction(function () use ($con, $query) {
409
            return $query->doInsert($con);
410
        });
411
    }
412
413
} // TaskTableMap
414
// This is the static code needed to register the TableMap for this table with the main Propel class.

app/Models/User/Map/UserTableMap.php 1 location

@@ 418-443 (lines=26) @@
415
     * @throws PropelException Any exceptions caught during processing will be
416
     *                         rethrown wrapped into a PropelException.
417
     */
418
    public static function doInsert($criteria, ConnectionInterface $con = null)
419
    {
420
        if (null === $con) {
421
            $con = Propel::getServiceContainer()->getWriteConnection(UserTableMap::DATABASE_NAME);
422
        }
423
424
        if ($criteria instanceof Criteria) {
425
            $criteria = clone $criteria; // rename for clarity
426
        } else {
427
            $criteria = $criteria->buildCriteria(); // build Criteria from User object
428
        }
429
430
        if ($criteria->containsKey(UserTableMap::COL_ID) && $criteria->keyContainsValue(UserTableMap::COL_ID) ) {
431
            throw new PropelException('Cannot insert a value for auto-increment primary key ('.UserTableMap::COL_ID.')');
432
        }
433
434
435
        // Set the correct dbName
436
        $query = UserQuery::create()->mergeWith($criteria);
437
438
        // use transaction because $criteria could contain info
439
        // for more than one table (I guess, conceivably)
440
        return $con->transaction(function () use ($con, $query) {
441
            return $query->doInsert($con);
442
        });
443
    }
444
445
} // UserTableMap
446
// This is the static code needed to register the TableMap for this table with the main Propel class.