Code Duplication    Length = 13-13 lines in 2 locations

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

@@ 1455-1467 (lines=13) @@
1452
     *
1453
     * @throws TDBMException
1454
     */
1455
    public function findObject($mainTable, $filter = null, array $parameters = array(), array $additionalTablesFetch = array(), $className = null)
1456
    {
1457
        $objects = $this->findObjects($mainTable, $filter, $parameters, null, $additionalTablesFetch, self::MODE_ARRAY, $className);
1458
        $page = $objects->take(0, 2);
1459
        $count = $page->count();
1460
        if ($count > 1) {
1461
            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.");
1462
        } elseif ($count === 0) {
1463
            return;
1464
        }
1465
1466
        return $objects[0];
1467
    }
1468
1469
    /**
1470
     * Returns a unique bean (or null) according to the filters passed in parameter.
@@ 1482-1494 (lines=13) @@
1479
     *
1480
     * @throws TDBMException
1481
     */
1482
    public function findObjectFromSql($mainTable, $from, $filter = null, array $parameters = array(), $className = null)
1483
    {
1484
        $objects = $this->findObjectsFromSql($mainTable, $from, $filter, $parameters, null, self::MODE_ARRAY, $className);
1485
        $page = $objects->take(0, 2);
1486
        $count = $page->count();
1487
        if ($count > 1) {
1488
            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.");
1489
        } elseif ($count === 0) {
1490
            return;
1491
        }
1492
1493
        return $objects[0];
1494
    }
1495
1496
    /**
1497
     * Returns a unique bean according to the filters passed in parameter.