controllers
This commit is contained in:
parent
a65eb73b81
commit
2c63ca35e1
@ -3,6 +3,7 @@
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\Announcement;
|
||||
use App\Entity\InternApplication;
|
||||
use App\Form\AnnouncementType;
|
||||
use App\Repository\AnnouncementRepository;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
@ -65,6 +66,9 @@ class AnnouncementController extends AbstractController
|
||||
{
|
||||
$this->entityManager->persist($announcement);
|
||||
$this->entityManager->flush();
|
||||
|
||||
$this->addFlash('success', 'Annonce modifiéé avec succès.');
|
||||
return $this->redirectToRoute('app_announcement_list');
|
||||
}
|
||||
|
||||
return $this->render('announcement/add.html.twig', [
|
||||
@ -81,4 +85,39 @@ class AnnouncementController extends AbstractController
|
||||
|
||||
return $this->redirectToRoute('app_announcement_list');
|
||||
}
|
||||
|
||||
#[Route('/apply/{id}', name: '_apply')]
|
||||
public function applyToAnnouncement(int $id): Response
|
||||
{
|
||||
|
||||
$announcement = $this->announcementRepository->find($id);
|
||||
|
||||
$user = $this->getUser();
|
||||
|
||||
$existingCandidature = $this->entityManager->getRepository(InternApplication::class)->findOneBy([
|
||||
'intern' => $user,
|
||||
'announcement' => $announcement
|
||||
]);
|
||||
|
||||
if($existingCandidature) {
|
||||
$this->addFlash('error', 'Vous avez déjà postulé à cette annonce.');
|
||||
return $this->redirectToRoute('app_announcement_list');
|
||||
}
|
||||
$application = new InternApplication();
|
||||
$application->setIntern($user);
|
||||
$application->setIntern($announcement);
|
||||
$application->setApplicationDate(new \DateTime());
|
||||
|
||||
$this->entityManager->persist($application);
|
||||
$this->entityManager->flush();
|
||||
|
||||
$this->addFlash('success', 'Votre candidature a été envoyée avec succès.');
|
||||
return $this->redirectToRoute('annonce_list', ['id' => $announcement->getId()]);
|
||||
}
|
||||
|
||||
#[Route('/filterByCompany', name: '_filterByCompany')]
|
||||
public function filterByCompany(int $id): Response
|
||||
{
|
||||
return $this->redirectToRoute('annonce_list', ['id' => $id]);
|
||||
}
|
||||
}
|
||||
|
81
src/Controller/CompanyController.php
Normal file
81
src/Controller/CompanyController.php
Normal file
@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\Company;
|
||||
use App\Form\CompanyType;
|
||||
use App\Repository\CompanyRepository;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
|
||||
#[Route('/company')]
|
||||
final class CompanyController extends AbstractController
|
||||
{
|
||||
#[Route(name: 'app_company_index', methods: ['GET'])]
|
||||
public function index(CompanyRepository $companyRepository): Response
|
||||
{
|
||||
return $this->render('company/index.html.twig', [
|
||||
'companies' => $companyRepository->findAll(),
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/new', name: 'app_company_new', methods: ['GET', 'POST'])]
|
||||
public function new(Request $request, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$company = new Company();
|
||||
$form = $this->createForm(CompanyType::class, $company);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$entityManager->persist($company);
|
||||
$entityManager->flush();
|
||||
|
||||
return $this->redirectToRoute('app_company_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
|
||||
return $this->render('company/new.html.twig', [
|
||||
'company' => $company,
|
||||
'form' => $form,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}', name: 'app_company_show', methods: ['GET'])]
|
||||
public function show(Company $company): Response
|
||||
{
|
||||
return $this->render('company/show.html.twig', [
|
||||
'company' => $company,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}/edit', name: 'app_company_edit', methods: ['GET', 'POST'])]
|
||||
public function edit(Request $request, Company $company, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$form = $this->createForm(CompanyType::class, $company);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$entityManager->flush();
|
||||
|
||||
return $this->redirectToRoute('app_company_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
|
||||
return $this->render('company/edit.html.twig', [
|
||||
'company' => $company,
|
||||
'form' => $form,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}', name: 'app_company_delete', methods: ['POST'])]
|
||||
public function delete(Request $request, Company $company, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
if ($this->isCsrfTokenValid('delete'.$company->getId(), $request->getPayload()->getString('_token'))) {
|
||||
$entityManager->remove($company);
|
||||
$entityManager->flush();
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('app_company_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
}
|
81
src/Controller/DegreeController.php
Normal file
81
src/Controller/DegreeController.php
Normal file
@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\Degree;
|
||||
use App\Form\DegreeType;
|
||||
use App\Repository\DegreeRepository;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
|
||||
#[Route('/degree')]
|
||||
final class DegreeController extends AbstractController
|
||||
{
|
||||
#[Route(name: 'app_degree_index', methods: ['GET'])]
|
||||
public function index(DegreeRepository $degreeRepository): Response
|
||||
{
|
||||
return $this->render('degree/index.html.twig', [
|
||||
'degrees' => $degreeRepository->findAll(),
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/new', name: 'app_degree_new', methods: ['GET', 'POST'])]
|
||||
public function new(Request $request, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$degree = new Degree();
|
||||
$form = $this->createForm(DegreeType::class, $degree);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$entityManager->persist($degree);
|
||||
$entityManager->flush();
|
||||
|
||||
return $this->redirectToRoute('app_degree_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
|
||||
return $this->render('degree/new.html.twig', [
|
||||
'degree' => $degree,
|
||||
'form' => $form,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}', name: 'app_degree_show', methods: ['GET'])]
|
||||
public function show(Degree $degree): Response
|
||||
{
|
||||
return $this->render('degree/show.html.twig', [
|
||||
'degree' => $degree,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}/edit', name: 'app_degree_edit', methods: ['GET', 'POST'])]
|
||||
public function edit(Request $request, Degree $degree, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$form = $this->createForm(DegreeType::class, $degree);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$entityManager->flush();
|
||||
|
||||
return $this->redirectToRoute('app_degree_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
|
||||
return $this->render('degree/edit.html.twig', [
|
||||
'degree' => $degree,
|
||||
'form' => $form,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}', name: 'app_degree_delete', methods: ['POST'])]
|
||||
public function delete(Request $request, Degree $degree, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
if ($this->isCsrfTokenValid('delete'.$degree->getId(), $request->getPayload()->getString('_token'))) {
|
||||
$entityManager->remove($degree);
|
||||
$entityManager->flush();
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('app_degree_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
}
|
81
src/Controller/EmployeeController.php
Normal file
81
src/Controller/EmployeeController.php
Normal file
@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\Employee;
|
||||
use App\Form\EmployeeType;
|
||||
use App\Repository\EmployeeRepository;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
|
||||
#[Route('/employee')]
|
||||
final class EmployeeController extends AbstractController
|
||||
{
|
||||
#[Route(name: 'app_employee_index', methods: ['GET'])]
|
||||
public function index(EmployeeRepository $employeeRepository): Response
|
||||
{
|
||||
return $this->render('employee/index.html.twig', [
|
||||
'employees' => $employeeRepository->findAll(),
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/new', name: 'app_employee_new', methods: ['GET', 'POST'])]
|
||||
public function new(Request $request, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$employee = new Employee();
|
||||
$form = $this->createForm(EmployeeType::class, $employee);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$entityManager->persist($employee);
|
||||
$entityManager->flush();
|
||||
|
||||
return $this->redirectToRoute('app_employee_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
|
||||
return $this->render('employee/new.html.twig', [
|
||||
'employee' => $employee,
|
||||
'form' => $form,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}', name: 'app_employee_show', methods: ['GET'])]
|
||||
public function show(Employee $employee): Response
|
||||
{
|
||||
return $this->render('employee/show.html.twig', [
|
||||
'employee' => $employee,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}/edit', name: 'app_employee_edit', methods: ['GET', 'POST'])]
|
||||
public function edit(Request $request, Employee $employee, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$form = $this->createForm(EmployeeType::class, $employee);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$entityManager->flush();
|
||||
|
||||
return $this->redirectToRoute('app_employee_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
|
||||
return $this->render('employee/edit.html.twig', [
|
||||
'employee' => $employee,
|
||||
'form' => $form,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}', name: 'app_employee_delete', methods: ['POST'])]
|
||||
public function delete(Request $request, Employee $employee, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
if ($this->isCsrfTokenValid('delete'.$employee->getId(), $request->getPayload()->getString('_token'))) {
|
||||
$entityManager->remove($employee);
|
||||
$entityManager->flush();
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('app_employee_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
}
|
81
src/Controller/FAQController.php
Normal file
81
src/Controller/FAQController.php
Normal file
@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\FAQ;
|
||||
use App\Form\FAQType;
|
||||
use App\Repository\FAQRepository;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
|
||||
#[Route('/faq')]
|
||||
final class FAQController extends AbstractController
|
||||
{
|
||||
#[Route(name: 'app_faq_index', methods: ['GET'])]
|
||||
public function index(FAQRepository $fAQRepository): Response
|
||||
{
|
||||
return $this->render('faq/index.html.twig', [
|
||||
'faqs' => $fAQRepository->findAll(),
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/new', name: 'app_faq_new', methods: ['GET', 'POST'])]
|
||||
public function new(Request $request, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$fAQ = new FAQ();
|
||||
$form = $this->createForm(FAQType::class, $fAQ);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$entityManager->persist($fAQ);
|
||||
$entityManager->flush();
|
||||
|
||||
return $this->redirectToRoute('app_faq_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
|
||||
return $this->render('faq/new.html.twig', [
|
||||
'faq' => $fAQ,
|
||||
'form' => $form,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}', name: 'app_faq_show', methods: ['GET'])]
|
||||
public function show(FAQ $fAQ): Response
|
||||
{
|
||||
return $this->render('faq/show.html.twig', [
|
||||
'faq' => $fAQ,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}/edit', name: 'app_faq_edit', methods: ['GET', 'POST'])]
|
||||
public function edit(Request $request, FAQ $fAQ, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$form = $this->createForm(FAQType::class, $fAQ);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$entityManager->flush();
|
||||
|
||||
return $this->redirectToRoute('app_faq_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
|
||||
return $this->render('faq/edit.html.twig', [
|
||||
'faq' => $fAQ,
|
||||
'form' => $form,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}', name: 'app_faq_delete', methods: ['POST'])]
|
||||
public function delete(Request $request, FAQ $fAQ, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
if ($this->isCsrfTokenValid('delete'.$fAQ->getId(), $request->getPayload()->getString('_token'))) {
|
||||
$entityManager->remove($fAQ);
|
||||
$entityManager->flush();
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('app_faq_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
}
|
81
src/Controller/InternController.php
Normal file
81
src/Controller/InternController.php
Normal file
@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\Intern;
|
||||
use App\Form\InternType;
|
||||
use App\Repository\InternRepository;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
|
||||
#[Route('/intern')]
|
||||
final class InternController extends AbstractController
|
||||
{
|
||||
#[Route(name: 'app_intern_index', methods: ['GET'])]
|
||||
public function index(InternRepository $internRepository): Response
|
||||
{
|
||||
return $this->render('intern/index.html.twig', [
|
||||
'interns' => $internRepository->findAll(),
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/new', name: 'app_intern_new', methods: ['GET', 'POST'])]
|
||||
public function new(Request $request, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$intern = new Intern();
|
||||
$form = $this->createForm(InternType::class, $intern);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$entityManager->persist($intern);
|
||||
$entityManager->flush();
|
||||
|
||||
return $this->redirectToRoute('app_intern_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
|
||||
return $this->render('intern/new.html.twig', [
|
||||
'intern' => $intern,
|
||||
'form' => $form,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}', name: 'app_intern_show', methods: ['GET'])]
|
||||
public function show(Intern $intern): Response
|
||||
{
|
||||
return $this->render('intern/show.html.twig', [
|
||||
'intern' => $intern,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}/edit', name: 'app_intern_edit', methods: ['GET', 'POST'])]
|
||||
public function edit(Request $request, Intern $intern, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$form = $this->createForm(InternType::class, $intern);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$entityManager->flush();
|
||||
|
||||
return $this->redirectToRoute('app_intern_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
|
||||
return $this->render('intern/edit.html.twig', [
|
||||
'intern' => $intern,
|
||||
'form' => $form,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}', name: 'app_intern_delete', methods: ['POST'])]
|
||||
public function delete(Request $request, Intern $intern, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
if ($this->isCsrfTokenValid('delete'.$intern->getId(), $request->getPayload()->getString('_token'))) {
|
||||
$entityManager->remove($intern);
|
||||
$entityManager->flush();
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('app_intern_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
}
|
81
src/Controller/MessageController.php
Normal file
81
src/Controller/MessageController.php
Normal file
@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\Message;
|
||||
use App\Form\MessageType;
|
||||
use App\Repository\MessageRepository;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
|
||||
#[Route('/message')]
|
||||
final class MessageController extends AbstractController
|
||||
{
|
||||
#[Route(name: 'app_message_index', methods: ['GET'])]
|
||||
public function index(MessageRepository $messageRepository): Response
|
||||
{
|
||||
return $this->render('message/index.html.twig', [
|
||||
'messages' => $messageRepository->findAll(),
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/new', name: 'app_message_new', methods: ['GET', 'POST'])]
|
||||
public function new(Request $request, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$message = new Message();
|
||||
$form = $this->createForm(MessageType::class, $message);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$entityManager->persist($message);
|
||||
$entityManager->flush();
|
||||
|
||||
return $this->redirectToRoute('app_message_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
|
||||
return $this->render('message/new.html.twig', [
|
||||
'message' => $message,
|
||||
'form' => $form,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}', name: 'app_message_show', methods: ['GET'])]
|
||||
public function show(Message $message): Response
|
||||
{
|
||||
return $this->render('message/show.html.twig', [
|
||||
'message' => $message,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}/edit', name: 'app_message_edit', methods: ['GET', 'POST'])]
|
||||
public function edit(Request $request, Message $message, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$form = $this->createForm(MessageType::class, $message);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$entityManager->flush();
|
||||
|
||||
return $this->redirectToRoute('app_message_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
|
||||
return $this->render('message/edit.html.twig', [
|
||||
'message' => $message,
|
||||
'form' => $form,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}', name: 'app_message_delete', methods: ['POST'])]
|
||||
public function delete(Request $request, Message $message, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
if ($this->isCsrfTokenValid('delete'.$message->getId(), $request->getPayload()->getString('_token'))) {
|
||||
$entityManager->remove($message);
|
||||
$entityManager->flush();
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('app_message_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
}
|
81
src/Controller/SkillController.php
Normal file
81
src/Controller/SkillController.php
Normal file
@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\Skill;
|
||||
use App\Form\SkillType;
|
||||
use App\Repository\SkillRepository;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
|
||||
#[Route('/skill')]
|
||||
final class SkillController extends AbstractController
|
||||
{
|
||||
#[Route(name: 'app_skill_index', methods: ['GET'])]
|
||||
public function index(SkillRepository $skillRepository): Response
|
||||
{
|
||||
return $this->render('skill/index.html.twig', [
|
||||
'skills' => $skillRepository->findAll(),
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/new', name: 'app_skill_new', methods: ['GET', 'POST'])]
|
||||
public function new(Request $request, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$skill = new Skill();
|
||||
$form = $this->createForm(SkillType::class, $skill);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$entityManager->persist($skill);
|
||||
$entityManager->flush();
|
||||
|
||||
return $this->redirectToRoute('app_skill_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
|
||||
return $this->render('skill/new.html.twig', [
|
||||
'skill' => $skill,
|
||||
'form' => $form,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}', name: 'app_skill_show', methods: ['GET'])]
|
||||
public function show(Skill $skill): Response
|
||||
{
|
||||
return $this->render('skill/show.html.twig', [
|
||||
'skill' => $skill,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}/edit', name: 'app_skill_edit', methods: ['GET', 'POST'])]
|
||||
public function edit(Request $request, Skill $skill, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$form = $this->createForm(SkillType::class, $skill);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$entityManager->flush();
|
||||
|
||||
return $this->redirectToRoute('app_skill_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
|
||||
return $this->render('skill/edit.html.twig', [
|
||||
'skill' => $skill,
|
||||
'form' => $form,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}', name: 'app_skill_delete', methods: ['POST'])]
|
||||
public function delete(Request $request, Skill $skill, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
if ($this->isCsrfTokenValid('delete'.$skill->getId(), $request->getPayload()->getString('_token'))) {
|
||||
$entityManager->remove($skill);
|
||||
$entityManager->flush();
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('app_skill_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
}
|
81
src/Controller/UserAppController.php
Normal file
81
src/Controller/UserAppController.php
Normal file
@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\UserApp;
|
||||
use App\Form\UserAppType;
|
||||
use App\Repository\UserRepository;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
|
||||
#[Route('/user/app')]
|
||||
final class UserAppController extends AbstractController
|
||||
{
|
||||
#[Route(name: 'app_user_app_index', methods: ['GET'])]
|
||||
public function index(UserRepository $userRepository): Response
|
||||
{
|
||||
return $this->render('user_app/index.html.twig', [
|
||||
'user_apps' => $userRepository->findAll(),
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/new', name: 'app_user_app_new', methods: ['GET', 'POST'])]
|
||||
public function new(Request $request, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$userApp = new UserApp();
|
||||
$form = $this->createForm(UserAppType::class, $userApp);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$entityManager->persist($userApp);
|
||||
$entityManager->flush();
|
||||
|
||||
return $this->redirectToRoute('app_user_app_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
|
||||
return $this->render('user_app/new.html.twig', [
|
||||
'user_app' => $userApp,
|
||||
'form' => $form,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}', name: 'app_user_app_show', methods: ['GET'])]
|
||||
public function show(UserApp $userApp): Response
|
||||
{
|
||||
return $this->render('user_app/show.html.twig', [
|
||||
'user_app' => $userApp,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}/edit', name: 'app_user_app_edit', methods: ['GET', 'POST'])]
|
||||
public function edit(Request $request, UserApp $userApp, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$form = $this->createForm(UserAppType::class, $userApp);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$entityManager->flush();
|
||||
|
||||
return $this->redirectToRoute('app_user_app_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
|
||||
return $this->render('user_app/edit.html.twig', [
|
||||
'user_app' => $userApp,
|
||||
'form' => $form,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}', name: 'app_user_app_delete', methods: ['POST'])]
|
||||
public function delete(Request $request, UserApp $userApp, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
if ($this->isCsrfTokenValid('delete'.$userApp->getId(), $request->getPayload()->getString('_token'))) {
|
||||
$entityManager->remove($userApp);
|
||||
$entityManager->flush();
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('app_user_app_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
}
|
@ -22,13 +22,15 @@ class Announcement
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $description = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATE_MUTABLE)]
|
||||
private ?\DateTimeInterface $creationDate = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'announcements')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?Company $company = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'announcements')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?Status $status = null;
|
||||
#[ORM\Column(length: 255,nullable: false)]
|
||||
private ?string $status = "notVerified";
|
||||
|
||||
/**
|
||||
* @var ?Collection<int, InternApplication>
|
||||
@ -42,9 +44,6 @@ class Announcement
|
||||
#[ORM\OneToMany(targetEntity: InternFavorite::class, mappedBy: 'announcement')]
|
||||
private ?Collection $favoritesInterns;
|
||||
|
||||
#[ORM\Column(type: Types::DATE_MUTABLE)]
|
||||
private ?\DateTimeInterface $creationDate = null;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->applicants = new ArrayCollection();
|
||||
@ -92,7 +91,7 @@ class Announcement
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getStatus(): ?Status
|
||||
public function getStatus(): ?string
|
||||
{
|
||||
return $this->status;
|
||||
}
|
||||
|
@ -26,8 +26,8 @@ class UserApp implements UserInterface, PasswordAuthenticatedUserInterface
|
||||
/**
|
||||
* @var list<string> The user roles
|
||||
*/
|
||||
#[ORM\Column]
|
||||
private array $roles = [];
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?array $roles = null;
|
||||
|
||||
/**
|
||||
* @var string The hashed password
|
||||
|
@ -22,10 +22,6 @@ class AnnouncementType extends AbstractType
|
||||
'class' => Company::class,
|
||||
'choice_label' => 'id',
|
||||
])
|
||||
->add('status', EntityType::class, [
|
||||
'class' => Status::class,
|
||||
'choice_label' => 'id',
|
||||
])
|
||||
->add('submit', SubmitType::class)
|
||||
;
|
||||
}
|
||||
|
28
src/Form/CompanyType.php
Normal file
28
src/Form/CompanyType.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Form;
|
||||
|
||||
use App\Entity\Company;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class CompanyType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder
|
||||
->add('name')
|
||||
->add('address')
|
||||
->add('tel')
|
||||
->add('mail')
|
||||
;
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => Company::class,
|
||||
]);
|
||||
}
|
||||
}
|
25
src/Form/DegreeType.php
Normal file
25
src/Form/DegreeType.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Form;
|
||||
|
||||
use App\Entity\Degree;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class DegreeType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder
|
||||
->add('label')
|
||||
;
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => Degree::class,
|
||||
]);
|
||||
}
|
||||
}
|
38
src/Form/EmployeeType.php
Normal file
38
src/Form/EmployeeType.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Form;
|
||||
|
||||
use App\Entity\Company;
|
||||
use App\Entity\Employee;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class EmployeeType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder
|
||||
->add('nickname')
|
||||
->add('roles')
|
||||
->add('password')
|
||||
->add('firstName')
|
||||
->add('lastName')
|
||||
->add('tel')
|
||||
->add('address')
|
||||
->add('mail')
|
||||
->add('company', EntityType::class, [
|
||||
'class' => Company::class,
|
||||
'choice_label' => 'id',
|
||||
])
|
||||
;
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => Employee::class,
|
||||
]);
|
||||
}
|
||||
}
|
29
src/Form/FAQType.php
Normal file
29
src/Form/FAQType.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Form;
|
||||
|
||||
use App\Entity\FAQ;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class FAQType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder
|
||||
->add('question')
|
||||
->add('answer')
|
||||
->add('updateDate', null, [
|
||||
'widget' => 'single_text',
|
||||
])
|
||||
;
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => FAQ::class,
|
||||
]);
|
||||
}
|
||||
}
|
34
src/Form/InternType.php
Normal file
34
src/Form/InternType.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Form;
|
||||
|
||||
use App\Entity\Intern;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class InternType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder
|
||||
->add('nickname')
|
||||
->add('roles')
|
||||
->add('password')
|
||||
->add('firstName')
|
||||
->add('lastName')
|
||||
->add('tel')
|
||||
->add('address')
|
||||
->add('mail')
|
||||
->add('coverLetter')
|
||||
->add('resume')
|
||||
;
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => Intern::class,
|
||||
]);
|
||||
}
|
||||
}
|
38
src/Form/MessageType.php
Normal file
38
src/Form/MessageType.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Form;
|
||||
|
||||
use App\Entity\Message;
|
||||
use App\Entity\UserApp;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class MessageType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder
|
||||
->add('content')
|
||||
->add('sendingDate', null, [
|
||||
'widget' => 'single_text',
|
||||
])
|
||||
->add('sender', EntityType::class, [
|
||||
'class' => UserApp::class,
|
||||
'choice_label' => 'id',
|
||||
])
|
||||
->add('receiver', EntityType::class, [
|
||||
'class' => UserApp::class,
|
||||
'choice_label' => 'id',
|
||||
])
|
||||
;
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => Message::class,
|
||||
]);
|
||||
}
|
||||
}
|
25
src/Form/SkillType.php
Normal file
25
src/Form/SkillType.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Form;
|
||||
|
||||
use App\Entity\Skill;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class SkillType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder
|
||||
->add('label')
|
||||
;
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => Skill::class,
|
||||
]);
|
||||
}
|
||||
}
|
32
src/Form/UserAppType.php
Normal file
32
src/Form/UserAppType.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Form;
|
||||
|
||||
use App\Entity\UserApp;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class UserAppType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder
|
||||
->add('nickname')
|
||||
->add('roles')
|
||||
->add('password')
|
||||
->add('firstName')
|
||||
->add('lastName')
|
||||
->add('tel')
|
||||
->add('address')
|
||||
->add('mail')
|
||||
;
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => UserApp::class,
|
||||
]);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user