-Ajout de la connexion page favoris à la db
This commit is contained in:
@ -22,10 +22,8 @@ class FavorisController extends AbstractController
|
|||||||
public function index(FavorisRepository $favorisRepository): Response
|
public function index(FavorisRepository $favorisRepository): Response
|
||||||
{
|
{
|
||||||
$favorisUser = $favorisRepository->findBy(['user' => $this->getUser()]);
|
$favorisUser = $favorisRepository->findBy(['user' => $this->getUser()]);
|
||||||
foreach ($favorisUser as $favori) {
|
ini_set('memory_limit', '512M');
|
||||||
array_push($this->favorisResult, $this->googleBooksService->searchBooks($favori->getIdGoogle(), 'fr', 0));
|
array_push($this->favorisResult, $favorisRepository->getFavorisByUser($this->getUser()));
|
||||||
|
|
||||||
}
|
|
||||||
return $this->render('favoris/index.html.twig', [
|
return $this->render('favoris/index.html.twig', [
|
||||||
'controller_name' => 'FavorisController',
|
'controller_name' => 'FavorisController',
|
||||||
'datas' => $this->favorisResult,
|
'datas' => $this->favorisResult,
|
||||||
|
@ -3,17 +3,9 @@
|
|||||||
{% block title %}Mes favoris{% endblock %}
|
{% block title %}Mes favoris{% endblock %}
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<div>
|
{% for data in datas %}
|
||||||
{% for data in datas %}
|
{% for book in data %}
|
||||||
{% if data.items is defined %}
|
<p>{{ book.title }}</p>
|
||||||
{% for book in data.items %}
|
|
||||||
{% if book.volumeInfo.authors is defined %}
|
|
||||||
<p>{{ book.volumeInfo.title }} - {{ book.volumeInfo.authors | join(", ") }} </p>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endfor %}
|
||||||
|
|
||||||
{% endfor %}
|
|
||||||
</div>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
Reference in New Issue
Block a user