WIP: Implement application process
This commit is contained in:
1 parent
8e3499581a
commit
abced8c924
26 files changed
+802
-138
No files matched your search
@@ -3,7 +3,10 @@
|
||||
namespace App\Controller\Teamer;
|
||||
|
||||
use App\Entity\User;
|
||||
use App\Repository\AssignmentRepository;
|
||||
use Knp\Component\Pager\PaginatorInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
@@ -11,12 +14,16 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||
|
||||
class IndexController extends AbstractController
|
||||
{
|
||||
public function __construct(private readonly ValidatorInterface $validator)
|
||||
{}
|
||||
public function __construct(
|
||||
private readonly ValidatorInterface $validator,
|
||||
private readonly PaginatorInterface $paginator,
|
||||
private readonly AssignmentRepository $assignmentRepository
|
||||
) {
|
||||
}
|
||||
|
||||
#[Route('/teamer', name: 'app_teamer_index')]
|
||||
#[IsGranted('ROLE_TEAMER')]
|
||||
public function index(): Response
|
||||
public function index(Request $request): Response
|
||||
{
|
||||
/** @var User $user */
|
||||
$user = $this->getUser();
|
||||
@@ -25,7 +32,23 @@ class IndexController extends AbstractController
|
||||
// Validate teamer data to show missing data right away
|
||||
$errors = $this->validator->validate($teamer, null, ['profile_preflight']);
|
||||
|
||||
$query = $this
|
||||
->assignmentRepository
|
||||
->getListQuery()
|
||||
;
|
||||
|
||||
$pagination = $this->paginator->paginate(
|
||||
$query,
|
||||
$request->query->getInt('page', 1),
|
||||
10,
|
||||
[
|
||||
'defaultSortFieldName' => 'assignment.dateFrom',
|
||||
'defaultSortDirection' => 'asc',
|
||||
]
|
||||
);
|
||||
|
||||
return $this->render('teamer/index.html.twig', [
|
||||
'pagination' => $pagination,
|
||||
'errors' => $errors,
|
||||
]);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user