forked from GNUsocial/gnu-social
[DB][DOCUMENTATION] Explain limit: 2 in findOneBy
This commit is contained in:
parent
c3db2f60d2
commit
fe86735b8b
@ -175,7 +175,7 @@ abstract class DB
|
|||||||
*/
|
*/
|
||||||
public static function findOneBy(string $table, array $criteria, ?array $orderBy = null, ?int $offset = null)
|
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)) {
|
switch (count($res)) {
|
||||||
case 0:
|
case 0:
|
||||||
throw new NotFoundException("No value in table {$table} matches the requested criteria");
|
throw new NotFoundException("No value in table {$table} matches the requested criteria");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user