mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +00:00
fix random thid party
This commit is contained in:
parent
7a1ad24f0e
commit
8ed2e7585d
@ -53,15 +53,19 @@ class SearchApi
|
|||||||
{
|
{
|
||||||
$thirdPartiesIds = $this->em->createQuery('SELECT t.id FROM '.ThirdParty::class.' t')
|
$thirdPartiesIds = $this->em->createQuery('SELECT t.id FROM '.ThirdParty::class.' t')
|
||||||
->getScalarResult();
|
->getScalarResult();
|
||||||
|
|
||||||
$nbResults = rand(0, 15);
|
$nbResults = rand(0, 15);
|
||||||
|
|
||||||
if ($nbResults === 1) {
|
if ($nbResults === 1) {
|
||||||
$nbResults++;
|
$nbResults++;
|
||||||
|
} elseif ($nbResults === 0) {
|
||||||
|
return [];
|
||||||
}
|
}
|
||||||
$ids = \array_rand($thirdPartiesIds, $nbResults);
|
$ids = \array_map(function ($e) use ($thirdPartiesIds) { return $thirdPartiesIds[$e]['id'];},
|
||||||
|
\array_rand($thirdPartiesIds, $nbResults));
|
||||||
|
|
||||||
return $this->em->getRepository(ThirdParty::class)
|
$a = $this->em->getRepository(ThirdParty::class)
|
||||||
->findById($ids);
|
->findById($ids);
|
||||||
|
return $a;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getPersons(string $query)
|
private function getPersons(string $query)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user