From 2c63ca35e14745f5ad87603fa26107b26e39b572 Mon Sep 17 00:00:00 2001 From: allavenavr Date: Thu, 21 Nov 2024 16:18:44 +0100 Subject: [PATCH] controllers --- src/Controller/AnnouncementController.php | 39 +++++++++++ src/Controller/CompanyController.php | 81 +++++++++++++++++++++++ src/Controller/DegreeController.php | 81 +++++++++++++++++++++++ src/Controller/EmployeeController.php | 81 +++++++++++++++++++++++ src/Controller/FAQController.php | 81 +++++++++++++++++++++++ src/Controller/InternController.php | 81 +++++++++++++++++++++++ src/Controller/MessageController.php | 81 +++++++++++++++++++++++ src/Controller/SkillController.php | 81 +++++++++++++++++++++++ src/Controller/UserAppController.php | 81 +++++++++++++++++++++++ src/Entity/Announcement.php | 13 ++-- src/Entity/UserApp.php | 4 +- src/Form/AnnouncementType.php | 4 -- src/Form/CompanyType.php | 28 ++++++++ src/Form/DegreeType.php | 25 +++++++ src/Form/EmployeeType.php | 38 +++++++++++ src/Form/FAQType.php | 29 ++++++++ src/Form/InternType.php | 34 ++++++++++ src/Form/MessageType.php | 38 +++++++++++ src/Form/SkillType.php | 25 +++++++ src/Form/UserAppType.php | 32 +++++++++ 20 files changed, 944 insertions(+), 13 deletions(-) create mode 100644 src/Controller/CompanyController.php create mode 100644 src/Controller/DegreeController.php create mode 100644 src/Controller/EmployeeController.php create mode 100644 src/Controller/FAQController.php create mode 100644 src/Controller/InternController.php create mode 100644 src/Controller/MessageController.php create mode 100644 src/Controller/SkillController.php create mode 100644 src/Controller/UserAppController.php create mode 100644 src/Form/CompanyType.php create mode 100644 src/Form/DegreeType.php create mode 100644 src/Form/EmployeeType.php create mode 100644 src/Form/FAQType.php create mode 100644 src/Form/InternType.php create mode 100644 src/Form/MessageType.php create mode 100644 src/Form/SkillType.php create mode 100644 src/Form/UserAppType.php diff --git a/src/Controller/AnnouncementController.php b/src/Controller/AnnouncementController.php index 9ca78fc..150595b 100644 --- a/src/Controller/AnnouncementController.php +++ b/src/Controller/AnnouncementController.php @@ -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]); + } } diff --git a/src/Controller/CompanyController.php b/src/Controller/CompanyController.php new file mode 100644 index 0000000..0ddeb19 --- /dev/null +++ b/src/Controller/CompanyController.php @@ -0,0 +1,81 @@ +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); + } +} diff --git a/src/Controller/DegreeController.php b/src/Controller/DegreeController.php new file mode 100644 index 0000000..d7d54e0 --- /dev/null +++ b/src/Controller/DegreeController.php @@ -0,0 +1,81 @@ +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); + } +} diff --git a/src/Controller/EmployeeController.php b/src/Controller/EmployeeController.php new file mode 100644 index 0000000..6e096c7 --- /dev/null +++ b/src/Controller/EmployeeController.php @@ -0,0 +1,81 @@ +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); + } +} diff --git a/src/Controller/FAQController.php b/src/Controller/FAQController.php new file mode 100644 index 0000000..fbba2aa --- /dev/null +++ b/src/Controller/FAQController.php @@ -0,0 +1,81 @@ +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); + } +} diff --git a/src/Controller/InternController.php b/src/Controller/InternController.php new file mode 100644 index 0000000..fd4063d --- /dev/null +++ b/src/Controller/InternController.php @@ -0,0 +1,81 @@ +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); + } +} diff --git a/src/Controller/MessageController.php b/src/Controller/MessageController.php new file mode 100644 index 0000000..f46276b --- /dev/null +++ b/src/Controller/MessageController.php @@ -0,0 +1,81 @@ +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); + } +} diff --git a/src/Controller/SkillController.php b/src/Controller/SkillController.php new file mode 100644 index 0000000..2d2adac --- /dev/null +++ b/src/Controller/SkillController.php @@ -0,0 +1,81 @@ +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); + } +} diff --git a/src/Controller/UserAppController.php b/src/Controller/UserAppController.php new file mode 100644 index 0000000..f6e8161 --- /dev/null +++ b/src/Controller/UserAppController.php @@ -0,0 +1,81 @@ +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); + } +} diff --git a/src/Entity/Announcement.php b/src/Entity/Announcement.php index 94cf1a6..6360da7 100644 --- a/src/Entity/Announcement.php +++ b/src/Entity/Announcement.php @@ -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 @@ -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; } diff --git a/src/Entity/UserApp.php b/src/Entity/UserApp.php index fe10006..5c68f4f 100644 --- a/src/Entity/UserApp.php +++ b/src/Entity/UserApp.php @@ -26,8 +26,8 @@ class UserApp implements UserInterface, PasswordAuthenticatedUserInterface /** * @var list The user roles */ - #[ORM\Column] - private array $roles = []; + #[ORM\Column(nullable: true)] + private ?array $roles = null; /** * @var string The hashed password diff --git a/src/Form/AnnouncementType.php b/src/Form/AnnouncementType.php index ef1255f..21a844d 100644 --- a/src/Form/AnnouncementType.php +++ b/src/Form/AnnouncementType.php @@ -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) ; } diff --git a/src/Form/CompanyType.php b/src/Form/CompanyType.php new file mode 100644 index 0000000..33ec969 --- /dev/null +++ b/src/Form/CompanyType.php @@ -0,0 +1,28 @@ +add('name') + ->add('address') + ->add('tel') + ->add('mail') + ; + } + + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([ + 'data_class' => Company::class, + ]); + } +} diff --git a/src/Form/DegreeType.php b/src/Form/DegreeType.php new file mode 100644 index 0000000..bf70b71 --- /dev/null +++ b/src/Form/DegreeType.php @@ -0,0 +1,25 @@ +add('label') + ; + } + + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([ + 'data_class' => Degree::class, + ]); + } +} diff --git a/src/Form/EmployeeType.php b/src/Form/EmployeeType.php new file mode 100644 index 0000000..3ff32e3 --- /dev/null +++ b/src/Form/EmployeeType.php @@ -0,0 +1,38 @@ +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, + ]); + } +} diff --git a/src/Form/FAQType.php b/src/Form/FAQType.php new file mode 100644 index 0000000..c420a1c --- /dev/null +++ b/src/Form/FAQType.php @@ -0,0 +1,29 @@ +add('question') + ->add('answer') + ->add('updateDate', null, [ + 'widget' => 'single_text', + ]) + ; + } + + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([ + 'data_class' => FAQ::class, + ]); + } +} diff --git a/src/Form/InternType.php b/src/Form/InternType.php new file mode 100644 index 0000000..a2b7931 --- /dev/null +++ b/src/Form/InternType.php @@ -0,0 +1,34 @@ +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, + ]); + } +} diff --git a/src/Form/MessageType.php b/src/Form/MessageType.php new file mode 100644 index 0000000..b1208d9 --- /dev/null +++ b/src/Form/MessageType.php @@ -0,0 +1,38 @@ +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, + ]); + } +} diff --git a/src/Form/SkillType.php b/src/Form/SkillType.php new file mode 100644 index 0000000..7e3df80 --- /dev/null +++ b/src/Form/SkillType.php @@ -0,0 +1,25 @@ +add('label') + ; + } + + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([ + 'data_class' => Skill::class, + ]); + } +} diff --git a/src/Form/UserAppType.php b/src/Form/UserAppType.php new file mode 100644 index 0000000..dbd2033 --- /dev/null +++ b/src/Form/UserAppType.php @@ -0,0 +1,32 @@ +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, + ]); + } +}