Code Duplication    Length = 13-13 lines in 2 locations

src/Mouf/Database/TDBM/TDBMService.php 2 locations

@@ 1450-1462 (lines=13) @@
1447
     *
1448
     * @throws TDBMException
1449
     */
1450
    public function findObject($mainTable, $filter = null, array $parameters = array(), array $additionalTablesFetch = array(), $className = null)
1451
    {
1452
        $objects = $this->findObjects($mainTable, $filter, $parameters, null, $additionalTablesFetch, self::MODE_ARRAY, $className);
1453
        $page = $objects->take(0, 2);
1454
        $count = $page->count();
1455
        if ($count > 1) {
1456
            throw new DuplicateRowException("Error while querying an object for table '$mainTable': More than 1 row have been returned, but we should have received at most one.");
1457
        } elseif ($count === 0) {
1458
            return;
1459
        }
1460
1461
        return $objects[0];
1462
    }
1463
1464
    /**
1465
     * Returns a unique bean (or null) according to the filters passed in parameter.
@@ 1477-1489 (lines=13) @@
1474
     *
1475
     * @throws TDBMException
1476
     */
1477
    public function findObjectFromSql($mainTable, $from, $filter = null, array $parameters = array(), $className = null)
1478
    {
1479
        $objects = $this->findObjectsFromSql($mainTable, $from, $filter, $parameters, null, self::MODE_ARRAY, $className);
1480
        $page = $objects->take(0, 2);
1481
        $count = $page->count();
1482
        if ($count > 1) {
1483
            throw new DuplicateRowException("Error while querying an object for table '$mainTable': More than 1 row have been returned, but we should have received at most one.");
1484
        } elseif ($count === 0) {
1485
            return;
1486
        }
1487
1488
        return $objects[0];
1489
    }
1490
1491
    /**
1492
     * Returns a unique bean according to the filters passed in parameter.