Code Duplication    Length = 29-29 lines in 3 locations

packages/core/src/Models/Task/Map/TaskTableMap.php 1 location

@@ 336-364 (lines=29) @@
333
     * @throws PropelException Any exceptions caught during processing will be
334
     *                         rethrown wrapped into a PropelException.
335
     */
336
     public static function doDelete($values, ConnectionInterface $con = null)
337
     {
338
        if (null === $con) {
339
            $con = Propel::getServiceContainer()->getWriteConnection(TaskTableMap::DATABASE_NAME);
340
        }
341
342
        if ($values instanceof Criteria) {
343
            // rename for clarity
344
            $criteria = $values;
345
        } elseif ($values instanceof \Core\Models\Task\Task) { // it's a model object
346
            // create criteria based on pk values
347
            $criteria = $values->buildPkeyCriteria();
348
        } else { // it's a primary key, or an array of pks
349
            $criteria = new Criteria(TaskTableMap::DATABASE_NAME);
350
            $criteria->add(TaskTableMap::COL_ID, (array) $values, Criteria::IN);
351
        }
352
353
        $query = TaskQuery::create()->mergeWith($criteria);
354
355
        if ($values instanceof Criteria) {
356
            TaskTableMap::clearInstancePool();
357
        } elseif (!is_object($values)) { // it's a primary key, or an array of pks
358
            foreach ((array) $values as $singleval) {
359
                TaskTableMap::removeInstanceFromPool($singleval);
360
            }
361
        }
362
363
        return $query->delete($con);
364
    }
365
366
    /**
367
     * Deletes all rows from the tasks table.

packages/core/src/Models/User/Map/UserTableMap.php 1 location

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

packages/selfprice/src/Models/Selfprice/Map/SelfpriceTableMap.php 1 location

@@ 344-372 (lines=29) @@
341
     * @throws PropelException Any exceptions caught during processing will be
342
     *                         rethrown wrapped into a PropelException.
343
     */
344
     public static function doDelete($values, ConnectionInterface $con = null)
345
     {
346
        if (null === $con) {
347
            $con = Propel::getServiceContainer()->getWriteConnection(SelfpriceTableMap::DATABASE_NAME);
348
        }
349
350
        if ($values instanceof Criteria) {
351
            // rename for clarity
352
            $criteria = $values;
353
        } elseif ($values instanceof \Selfprice\Models\Selfprice\Selfprice) { // it's a model object
354
            // create criteria based on pk values
355
            $criteria = $values->buildPkeyCriteria();
356
        } else { // it's a primary key, or an array of pks
357
            $criteria = new Criteria(SelfpriceTableMap::DATABASE_NAME);
358
            $criteria->add(SelfpriceTableMap::COL_ID, (array) $values, Criteria::IN);
359
        }
360
361
        $query = SelfpriceQuery::create()->mergeWith($criteria);
362
363
        if ($values instanceof Criteria) {
364
            SelfpriceTableMap::clearInstancePool();
365
        } elseif (!is_object($values)) { // it's a primary key, or an array of pks
366
            foreach ((array) $values as $singleval) {
367
                SelfpriceTableMap::removeInstanceFromPool($singleval);
368
            }
369
        }
370
371
        return $query->delete($con);
372
    }
373
374
    /**
375
     * Deletes all rows from the selfprice table.