bool to check liked
This commit is contained in:
parent
c5c57796a4
commit
b6252fe861
@ -83,6 +83,27 @@ class SearchController extends AbstractController
|
||||
|
||||
$results = $response["results"];
|
||||
SearchController::addFruitToAlbums($results, $fruit, $entityManager);
|
||||
$user = $this->getUser();
|
||||
$array_id = array();
|
||||
foreach($user->getLiked() as $like){
|
||||
array_push(
|
||||
$array_id,
|
||||
$like->getAlbumId()
|
||||
);
|
||||
}
|
||||
$true_results = array();
|
||||
foreach($results as $result){
|
||||
|
||||
$isLiked = in_array($result["id"],$array_id);
|
||||
|
||||
$result = array_merge(
|
||||
$result,
|
||||
["isLiked" => $isLiked? "true": "false"]
|
||||
);
|
||||
array_push($true_results,$result);
|
||||
}
|
||||
|
||||
$results = $true_results;
|
||||
|
||||
return $this->render('search/search.html.twig', [
|
||||
'controller_name' => 'SearchController',
|
||||
|
Loading…
Reference in New Issue
Block a user