|
|
@@ -14,6 +14,7 @@ use App\Repository\ProjectBoostStore; |
|
|
|
use App\Repository\ProjectInspiringStore; |
|
|
|
use App\Repository\RevoltStore; |
|
|
|
use Doctrine\ORM\EntityManagerInterface; |
|
|
|
use Knp\Component\Pager\PaginatorInterface; |
|
|
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; |
|
|
|
use Symfony\Component\HttpFoundation\JsonResponse; |
|
|
|
use Symfony\Component\HttpFoundation\Response; |
|
|
@@ -24,24 +25,27 @@ use Symfony\Component\HttpFoundation\Request; |
|
|
|
|
|
|
|
class DefaultController extends AbstractController |
|
|
|
{ |
|
|
|
protected $em; |
|
|
|
protected EntityManagerInterface $em; |
|
|
|
protected DreamStore $dreamStore; |
|
|
|
protected RevoltStore $revoltStore; |
|
|
|
protected ProjectBoostStore $projectBoostStore; |
|
|
|
protected ProjectInspiringStore $projectInspiringStore; |
|
|
|
protected PaginatorInterface $paginator; |
|
|
|
|
|
|
|
public function __construct( |
|
|
|
EntityManagerInterface $em, |
|
|
|
DreamStore $dreamStore, |
|
|
|
RevoltStore $revoltStore, |
|
|
|
ProjectBoostStore $projectBoostStore, |
|
|
|
ProjectInspiringStore $projectInspiringStore |
|
|
|
ProjectInspiringStore $projectInspiringStore, |
|
|
|
PaginatorInterface $paginator |
|
|
|
) { |
|
|
|
$this->em = $em; |
|
|
|
$this->dreamStore = $dreamStore; |
|
|
|
$this->revoltStore = $revoltStore; |
|
|
|
$this->projectBoostStore = $projectBoostStore; |
|
|
|
$this->projectInspiringStore = $projectInspiringStore; |
|
|
|
$this->paginator = $paginator; |
|
|
|
} |
|
|
|
|
|
|
|
public function home() |
|
|
@@ -61,7 +65,7 @@ class DefaultController extends AbstractController |
|
|
|
|
|
|
|
public function cartoListe(Request $request) |
|
|
|
{ |
|
|
|
$dreamArray = $revoltArray = $projectBoostArray = $projectInspiringArray = $resultArray = array(); |
|
|
|
$dreamArray = $revoltArray = $projectBoostArray = $projectInspiringArray = $resultArray = $resultArrayPagination = array(); |
|
|
|
|
|
|
|
$form = $this->createForm(SearchListForm::class); |
|
|
|
$form->handleRequest($request); |
|
|
@@ -87,6 +91,12 @@ class DefaultController extends AbstractController |
|
|
|
} |
|
|
|
|
|
|
|
$resultArray = array_merge($dreamArray, $revoltArray, $projectBoostArray, $projectInspiringArray); |
|
|
|
|
|
|
|
$resultArrayPagination = $this->paginator->paginate( |
|
|
|
$resultArray, |
|
|
|
$request->query->getInt('page', 1), |
|
|
|
2 |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
return $this->render( |
|
|
@@ -94,7 +104,7 @@ class DefaultController extends AbstractController |
|
|
|
[ |
|
|
|
'form' => $form->createView(), |
|
|
|
'nbContrib' => $this->countContrib(), |
|
|
|
'resultArray' => $resultArray |
|
|
|
'resultArray' => $resultArrayPagination |
|
|
|
] |
|
|
|
); |
|
|
|
} |