Code Duplication    Length = 13-13 lines in 2 locations

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

@@ 1272-1284 (lines=13) @@
1269
     *
1270
     * @throws TDBMException
1271
     */
1272
    public function findObject(string $mainTable, $filter = null, array $parameters = array(), array $additionalTablesFetch = array(), string $className = null)
1273
    {
1274
        $objects = $this->findObjects($mainTable, $filter, $parameters, null, $additionalTablesFetch, self::MODE_ARRAY, $className);
1275
        $page = $objects->take(0, 2);
1276
        $count = $page->count();
1277
        if ($count > 1) {
1278
            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.");
1279
        } elseif ($count === 0) {
1280
            return;
1281
        }
1282
1283
        return $page[0];
1284
    }
1285
1286
    /**
1287
     * Returns a unique bean (or null) according to the filters passed in parameter.
@@ 1299-1311 (lines=13) @@
1296
     *
1297
     * @throws TDBMException
1298
     */
1299
    public function findObjectFromSql($mainTable, $from, $filter = null, array $parameters = array(), $className = null)
1300
    {
1301
        $objects = $this->findObjectsFromSql($mainTable, $from, $filter, $parameters, null, self::MODE_ARRAY, $className);
1302
        $page = $objects->take(0, 2);
1303
        $count = $page->count();
1304
        if ($count > 1) {
1305
            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.");
1306
        } elseif ($count === 0) {
1307
            return;
1308
        }
1309
1310
        return $page[0];
1311
    }
1312
1313
    /**
1314
     * Returns a unique bean according to the filters passed in parameter.