[DB][DOCUMENTATION] Explain limit: 2 in findOneBy

This commit is contained in:
Hugo Sales 2021-08-16 17:07:00 +01:00
parent fb861ed41f
commit e30ae79eb7
Signed by untrusted user: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0

View File

@ -175,7 +175,7 @@ abstract class DB
*/
public static function findOneBy(string $table, array $criteria, ?array $orderBy = null, ?int $offset = null)
{
$res = self::findBy($table, $criteria, $orderBy, 2, $offset);
$res = self::findBy($table, $criteria, $orderBy, 2, $offset); // Use limit 2 to check for consistency
switch (count($res)) {
case 0:
throw new NotFoundException("No value in table {$table} matches the requested criteria");