Code Duplication    Length = 13-13 lines in 2 locations

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

@@ 1632-1644 (lines=13) @@
1629
     *
1630
     * @throws TDBMException
1631
     */
1632
    public function findObject(string $mainTable, $filter = null, array $parameters = array(), array $additionalTablesFetch = array(), string $className = null)
1633
    {
1634
        $objects = $this->findObjects($mainTable, $filter, $parameters, null, $additionalTablesFetch, self::MODE_ARRAY, $className);
1635
        $page = $objects->take(0, 2);
1636
        $count = $page->count();
1637
        if ($count > 1) {
1638
            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.");
1639
        } elseif ($count === 0) {
1640
            return;
1641
        }
1642
1643
        return $page[0];
1644
    }
1645
1646
    /**
1647
     * Returns a unique bean (or null) according to the filters passed in parameter.
@@ 1659-1671 (lines=13) @@
1656
     *
1657
     * @throws TDBMException
1658
     */
1659
    public function findObjectFromSql($mainTable, $from, $filter = null, array $parameters = array(), $className = null)
1660
    {
1661
        $objects = $this->findObjectsFromSql($mainTable, $from, $filter, $parameters, null, self::MODE_ARRAY, $className);
1662
        $page = $objects->take(0, 2);
1663
        $count = $page->count();
1664
        if ($count > 1) {
1665
            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.");
1666
        } elseif ($count === 0) {
1667
            return;
1668
        }
1669
1670
        return $page[0];
1671
    }
1672
1673
    /**
1674
     * Returns a unique bean according to the filters passed in parameter.