V-Beta-1.0.0
Vision is out of alpha !
This commit is contained in:
36
src/Controller/HomeController.php
Normal file
36
src/Controller/HomeController.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Repository\DocumentRepository;
|
||||
use App\Repository\DirectoryRepository;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
|
||||
class HomeController extends AbstractController
|
||||
{
|
||||
#[Route('/', name: 'home')]
|
||||
public function home(
|
||||
DocumentRepository $DocumentRepository,
|
||||
DirectoryRepository $DirectoryRepository
|
||||
): Response {
|
||||
|
||||
return $this->render('home/home.html.twig', [
|
||||
'documents' =>
|
||||
$DocumentRepository ->listForUser($this->getUser())
|
||||
->limit(10)
|
||||
->order(['createdAt' => 'DESC'])
|
||||
->getResult(),
|
||||
'announces' =>
|
||||
$DocumentRepository ->listForUser($this->getUser())
|
||||
->limitType('announce')
|
||||
->limit(3)
|
||||
->order(['createdAt' => 'DESC'])
|
||||
->getResult(),
|
||||
'wanted' =>
|
||||
$DirectoryRepository->list()->notDead()->wanted()->getResult(),
|
||||
'controller_name' => 'HomeController',
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user