mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +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')
|
||||
->getScalarResult();
|
||||
|
||||
$nbResults = rand(0, 15);
|
||||
|
||||
if ($nbResults === 1) {
|
||||
$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);
|
||||
return $a;
|
||||
}
|
||||
|
||||
private function getPersons(string $query)
|
||||
|
Loading…
x
Reference in New Issue
Block a user