Compare commits

..

5 Commits

54 changed files with 330 additions and 1655 deletions

View File

@ -1,7 +1,7 @@
security:
# https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords
password_hashers:
Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'plaintext' # à mettre en auto pour sécuriser les mdp
Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto' # à mettre en auto pour sécuriser les mdp
# https://symfony.com/doc/current/security.html#loading-the-user-the-user-provider
providers:
# used to reload user from session & other features (e.g. switch_user)

View File

@ -1,38 +0,0 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20241121141451 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('DROP SEQUENCE status_id_seq CASCADE');
$this->addSql('DROP TABLE status');
$this->addSql('ALTER TABLE userapp ADD is_verified BOOLEAN NOT NULL');
$this->addSql('ALTER TABLE userapp ALTER roles SET NOT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
$this->addSql('CREATE SEQUENCE status_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE TABLE status (id INT NOT NULL, label VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('ALTER TABLE userApp DROP is_verified');
$this->addSql('ALTER TABLE userApp ALTER roles DROP NOT NULL');
}
}

View File

@ -1,40 +0,0 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20241121141722 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE userapp ALTER first_name DROP NOT NULL');
$this->addSql('ALTER TABLE userapp ALTER last_name DROP NOT NULL');
$this->addSql('ALTER TABLE userapp ALTER tel DROP NOT NULL');
$this->addSql('ALTER TABLE userapp ALTER address DROP NOT NULL');
$this->addSql('ALTER TABLE userapp ALTER mail DROP NOT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
$this->addSql('ALTER TABLE userApp ALTER first_name SET NOT NULL');
$this->addSql('ALTER TABLE userApp ALTER last_name SET NOT NULL');
$this->addSql('ALTER TABLE userApp ALTER tel SET NOT NULL');
$this->addSql('ALTER TABLE userApp ALTER address SET NOT NULL');
$this->addSql('ALTER TABLE userApp ALTER mail SET NOT NULL');
}
}

View File

@ -1,31 +0,0 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20241121141818 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
}
}

View File

@ -1,32 +0,0 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20241121141912 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE userapp ALTER is_verified DROP NOT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
$this->addSql('ALTER TABLE userApp ALTER is_verified SET NOT NULL');
}
}

View File

@ -1,34 +0,0 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20241121142119 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE intern ALTER cover_letter DROP NOT NULL');
$this->addSql('ALTER TABLE intern ALTER resume DROP NOT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
$this->addSql('ALTER TABLE intern ALTER cover_letter SET NOT NULL');
$this->addSql('ALTER TABLE intern ALTER resume SET NOT NULL');
}
}

View File

@ -1,31 +0,0 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20241121142432 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
}
}

View File

@ -1,32 +0,0 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20241121145353 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE employee ALTER company_id DROP NOT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
$this->addSql('ALTER TABLE employee ALTER company_id SET NOT NULL');
}
}

View File

@ -5,6 +5,7 @@ namespace App\Controller;
use App\Entity\Announcement;
use App\Form\AnnouncementType;
use App\Repository\AnnouncementRepository;
use App\Repository\InternApplicationRepository;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
@ -14,8 +15,13 @@ use Symfony\Component\Routing\Attribute\Route;
#[Route('/announcement')]
final class AnnouncementController extends AbstractController
{
public function __construct(
private readonly EntityManagerInterface $entityManager,
private readonly AnnouncementRepository $announcementRepository,
){}
#[Route('/', name: 'app_announcement_index')]
public function list(Request $request, AnnouncementRepository $announcementRepository): Response
public function list(Request $request,): Response
{
$user = $this->getUser();
$announcements = [];
@ -28,9 +34,9 @@ final class AnnouncementController extends AbstractController
$showNonValidated = $request->query->get('show_non_validated');
if ($showNonValidated) {
$announcements = $announcementRepository->findBy(['status' => 'notVerified']);
$announcements = $this->announcementRepository->findBy(['status' => 'notVerified']);
} else {
$announcements = $announcementRepository->findAll();
$announcements = $this->announcementRepository->findAll();
}
}
@ -38,16 +44,16 @@ final class AnnouncementController extends AbstractController
$company = $user->getCompany();
if ($company) {
$announcements = $announcementRepository->findBy(['company' => $company]);
$announcements = $this->announcementRepository->findBy(['company' => $company]);
}
}
if (in_array('ROLE_INTERN', $user->getRoles())) {
$announcements = $announcementRepository->findBy(['status' => 'Verified']);
$announcements = $this->announcementRepository->findBy(['status' => 'Verified']);
}
if ($companyName || $location || $category) {
$announcements = $announcementRepository->searchAnnouncements($companyName, $location, $category);
$announcements = $this->announcementRepository->searchAnnouncements($companyName, $location, $category);
}
$favorites = [];
@ -68,7 +74,7 @@ final class AnnouncementController extends AbstractController
#[Route('/new', name: 'app_announcement_new', methods: ['GET', 'POST'])]
public function new(Request $request, EntityManagerInterface $entityManager): Response
public function new(Request $request,): Response
{
/*$user = $this->getUser();
@ -89,8 +95,8 @@ final class AnnouncementController extends AbstractController
if ($form->isSubmitted() && $form->isValid()) {
$announcement->setCreationDate(new \DateTime());
$announcement->setStatus('notVerified');
$entityManager->persist($announcement);
$entityManager->flush();
$this->entityManager->persist($announcement);
$this->entityManager->flush();
return $this->redirectToRoute('app_announcement_index', [], Response::HTTP_SEE_OTHER);
}
@ -110,13 +116,13 @@ final class AnnouncementController extends AbstractController
}
#[Route('/{id}/edit', name: 'app_announcement_edit', methods: ['GET', 'POST'])]
public function edit(Request $request, Announcement $announcement, EntityManagerInterface $entityManager): Response
public function edit(Request $request, Announcement $announcement,): Response
{
$form = $this->createForm(AnnouncementType::class, $announcement);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$entityManager->flush();
$this->entityManager->flush();
return $this->redirectToRoute('app_announcement_index', [], Response::HTTP_SEE_OTHER);
}
@ -128,23 +134,23 @@ final class AnnouncementController extends AbstractController
}
#[Route('/{id}', name: 'app_announcement_delete', methods: ['POST'])]
public function delete(Request $request, Announcement $announcement, EntityManagerInterface $entityManager): Response
public function delete(Request $request, Announcement $announcement,): Response
{
if ($this->isCsrfTokenValid('delete'.$announcement->getId(), $request->getPayload()->getString('_token'))) {
$entityManager->remove($announcement);
$entityManager->flush();
$this->entityManager->remove($announcement);
$this->entityManager->flush();
}
return $this->redirectToRoute('app_announcement_index', [], Response::HTTP_SEE_OTHER);
}
#[Route('/{id}/validate', name: 'app_announcement_validate', methods: ['POST'])]
public function validate(Request $request, Announcement $announcement, EntityManagerInterface $entityManager): Response
public function validate(Request $request, Announcement $announcement,): Response
{
if ($announcement->getStatus() !== 'Verified')
{
$announcement->setStatus('Verified');
$entityManager->flush();
$this->entityManager->flush();
}
return $this->redirectToRoute('app_announcement_show',
['id' => $announcement->getId()], Response::HTTP_SEE_OTHER);

View File

@ -4,7 +4,9 @@ namespace App\Controller;
use App\Entity\Company;
use App\Form\CompanyType;
use App\Repository\AnnouncementRepository;
use App\Repository\CompanyRepository;
use App\Repository\InternApplicationRepository;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
@ -15,25 +17,29 @@ use Symfony\Component\Security\Http\Attribute\IsGranted;
#[Route('/company')]
final class CompanyController extends AbstractController
{
public function __construct(
private readonly EntityManagerInterface $entityManager,
private readonly CompanyRepository $companyRepository,
){}
#[Route(name: 'app_company_index', methods: ['GET'])]
public function index(CompanyRepository $companyRepository): Response
public function index(): Response
{
return $this->render('company/index.html.twig', [
'companies' => $companyRepository->findAll(),
'companies' => $this->companyRepository->findAll(),
]);
}
#[Route('/new', name: 'app_company_new', methods: ['GET', 'POST'])]
#[IsGranted('ROLE_ADMIN')]
public function new(Request $request, EntityManagerInterface $entityManager): Response
public function new(Request $request,): Response
{
$company = new Company();
$form = $this->createForm(CompanyType::class, $company);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$entityManager->persist($company);
$entityManager->flush();
$this->entityManager->persist($company);
$this->entityManager->flush();
return $this->redirectToRoute('app_company_index', [], Response::HTTP_SEE_OTHER);
}
@ -54,13 +60,13 @@ final class CompanyController extends AbstractController
#[Route('/{id}/edit', name: 'app_company_edit', methods: ['GET', 'POST'])]
#[IsGranted('ROLE_ADMIN')]
public function edit(Request $request, Company $company, EntityManagerInterface $entityManager): Response
public function edit(Request $request, Company $company,): Response
{
$form = $this->createForm(CompanyType::class, $company);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$entityManager->flush();
$this->entityManager->flush();
return $this->redirectToRoute('app_company_index', [], Response::HTTP_SEE_OTHER);
}
@ -72,11 +78,11 @@ final class CompanyController extends AbstractController
}
#[Route('/{id}', name: 'app_company_delete', methods: ['POST'])]
public function delete(Request $request, Company $company, EntityManagerInterface $entityManager): Response
public function delete(Request $request, Company $company,): Response
{
if ($this->isCsrfTokenValid('delete'.$company->getId(), $request->getPayload()->getString('_token'))) {
$entityManager->remove($company);
$entityManager->flush();
$this->entityManager->remove($company);
$this->entityManager->flush();
}
return $this->redirectToRoute('app_company_index', [], Response::HTTP_SEE_OTHER);

View File

@ -5,7 +5,9 @@ namespace App\Controller;
use App\Entity\Degree;
use App\Entity\InternDegree;
use App\Form\DegreeType;
use App\Repository\AnnouncementRepository;
use App\Repository\DegreeRepository;
use App\Repository\InternApplicationRepository;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
@ -15,24 +17,28 @@ use Symfony\Component\Routing\Attribute\Route;
#[Route('/degree')]
final class DegreeController extends AbstractController
{
public function __construct(
private readonly EntityManagerInterface $entityManager,
private readonly DegreeRepository $degreeRepository,
){}
#[Route(name: 'app_degree_index', methods: ['GET'])]
public function index(DegreeRepository $degreeRepository): Response
public function index(): Response
{
return $this->render('degree/index.html.twig', [
'degrees' => $degreeRepository->findAll(),
'degrees' => $this->degreeRepository->findAll(),
]);
}
#[Route('/new', name: 'app_degree_new', methods: ['GET', 'POST'])]
public function new(Request $request, EntityManagerInterface $entityManager): Response
public function new(Request $request,): Response
{
$degree = new Degree();
$form = $this->createForm(DegreeType::class, $degree);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$entityManager->persist($degree);
$entityManager->flush();
$this->entityManager->persist($degree);
$this->entityManager->flush();
return $this->redirectToRoute('app_degree_index', [], Response::HTTP_SEE_OTHER);
}
@ -52,13 +58,13 @@ final class DegreeController extends AbstractController
}
#[Route('/{id}/edit', name: 'app_degree_edit', methods: ['GET', 'POST'])]
public function edit(Request $request, Degree $degree, EntityManagerInterface $entityManager): Response
public function edit(Request $request, Degree $degree,): Response
{
$form = $this->createForm(DegreeType::class, $degree);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$entityManager->flush();
$this->entityManager->flush();
return $this->redirectToRoute('app_degree_index', [], Response::HTTP_SEE_OTHER);
}
@ -70,11 +76,11 @@ final class DegreeController extends AbstractController
}
#[Route('/{id}', name: 'app_degree_delete', methods: ['POST'])]
public function delete(Request $request, Degree $degree, EntityManagerInterface $entityManager): Response
public function delete(Request $request, Degree $degree,): Response
{
if ($this->isCsrfTokenValid('delete'.$degree->getId(), $request->getPayload()->getString('_token'))) {
$entityManager->remove($degree);
$entityManager->flush();
$this->entityManager->remove($degree);
$this->entityManager->flush();
}
return $this->redirectToRoute('app_degree_index', [], Response::HTTP_SEE_OTHER);

View File

@ -92,5 +92,31 @@ final class EmployeeController extends AbstractController
]);
}
#[Route('/application/{id}/update-status/{status}', name: 'app_employee_update_application_status', methods: ['POST'])]
public function updateApplicationStatus(int $id, string $status): Response
{
$employee = $this->getUser();
if (!$employee instanceof Employee) {
throw $this->createAccessDeniedException('Seuls les employés peuvent accéder à cette action.');
}
$application = $this->internApplicationRepository->find($id);
if (!$application) {
throw $this->createNotFoundException('Candidature introuvable.');
}
$company = $employee->getCompany();
if ($application->getApplication()->getCompany() !== $company) {
throw $this->createAccessDeniedException('Cette candidature ne vous appartient pas.');
}
$application->setStatus($status);
$this->entityManager->flush();
$this->addFlash('success', 'Le statut de la candidature a bien été mis à jour.');
return $this->redirectToRoute('app_employee_seeApplications');
}
}

View File

@ -4,7 +4,9 @@ namespace App\Controller;
use App\Entity\FAQ;
use App\Form\FAQType;
use App\Repository\AnnouncementRepository;
use App\Repository\FAQRepository;
use App\Repository\InternApplicationRepository;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
@ -15,17 +17,21 @@ use Symfony\Component\Security\Http\Attribute\IsGranted;
#[Route('/faq')]
final class FAQController extends AbstractController
{
public function __construct(
private readonly EntityManagerInterface $entityManager,
private readonly FaqRepository $faqRepository,
){}
#[Route(name: 'app_faq_index', methods: ['GET'])]
public function index(FAQRepository $fAQRepository): Response
public function index(): Response
{
return $this->render('faq/index.html.twig', [
'faqs' => $fAQRepository->findAll(),
'faqs' => $this->faqRepository->findAll(),
]);
}
#[Route('/new', name: 'app_faq_new', methods: ['GET', 'POST'])]
#[IsGranted('ROLE_ADMIN')]
public function new(Request $request, EntityManagerInterface $entityManager): Response
public function new(Request $request,): Response
{
$fAQ = new FAQ();
$form = $this->createForm(FAQType::class, $fAQ);
@ -33,8 +39,8 @@ final class FAQController extends AbstractController
if ($form->isSubmitted() && $form->isValid()) {
$fAQ->setUpdateDate(new \DateTime());
$entityManager->persist($fAQ);
$entityManager->flush();
$this->entityManager->persist($fAQ);
$this->entityManager->flush();
return $this->redirectToRoute('app_faq_index', [], Response::HTTP_SEE_OTHER);
}
@ -55,14 +61,14 @@ final class FAQController extends AbstractController
#[Route('/{id}/edit', name: 'app_faq_edit', methods: ['GET', 'POST'])]
#[IsGranted('ROLE_ADMIN')]
public function edit(Request $request, FAQ $fAQ, EntityManagerInterface $entityManager): Response
public function edit(Request $request, FAQ $fAQ,): Response
{
$form = $this->createForm(FAQType::class, $fAQ);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$fAQ->setUpdateDate(new \DateTime());
$entityManager->flush();
$this->entityManager->flush();
return $this->redirectToRoute('app_faq_index', [], Response::HTTP_SEE_OTHER);
}
@ -75,11 +81,11 @@ final class FAQController extends AbstractController
#[Route('/{id}', name: 'app_faq_delete', methods: ['POST'])]
#[IsGranted('ROLE_ADMIN')]
public function delete(Request $request, FAQ $fAQ, EntityManagerInterface $entityManager): Response
public function delete(Request $request, FAQ $fAQ,): Response
{
if ($this->isCsrfTokenValid('delete'.$fAQ->getId(), $request->getPayload()->getString('_token'))) {
$entityManager->remove($fAQ);
$entityManager->flush();
$this->entityManager->remove($fAQ);
$this->entityManager->flush();
}
return $this->redirectToRoute('app_faq_index', [], Response::HTTP_SEE_OTHER);

View File

@ -3,7 +3,9 @@
namespace App\Controller;
use App\Entity\UserApp;
use App\Repository\AnnouncementRepository;
use App\Repository\CompanyRepository;
use App\Repository\InternApplicationRepository;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;

View File

@ -10,7 +10,13 @@ use App\Entity\InternDegree;
use App\Entity\InternSkill;
use App\Entity\Skill;
use App\Form\InternType;
use App\Repository\AnnouncementRepository;
use App\Repository\DegreeRepository;
use App\Repository\InternApplicationRepository;
use App\Repository\InternDegreeRepository;
use App\Repository\InternRepository;
use App\Repository\InternSkillRepository;
use App\Repository\SkillRepository;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
@ -20,11 +26,21 @@ use Symfony\Component\Routing\Attribute\Route;
#[Route('/intern')]
final class InternController extends AbstractController
{
public function __construct(
private readonly EntityManagerInterface $entityManager,
private readonly AnnouncementRepository $announcementRepository,
private readonly InternRepository $internRepository,
private readonly InternApplicationRepository $internApplicationRepository,
private readonly InternDegreeRepository $internDegreeRepository,
private readonly InternSkillRepository $internSkillRepository,
private readonly DegreeRepository $degreeRepository,
private readonly SkillRepository $skillRepository,
){}
#[Route(name: 'app_intern_index', methods: ['GET'])]
public function index(InternRepository $internRepository): Response
public function index(): Response
{
return $this->render('intern/index.html.twig', [
'interns' => $internRepository->findAll(),
'interns' => $this->internRepository->findAll(),
]);
}
@ -37,13 +53,13 @@ final class InternController extends AbstractController
}
#[Route('/{id}/edit', name: 'app_intern_edit', methods: ['GET', 'POST'])]
public function edit(Request $request, Intern $intern, EntityManagerInterface $entityManager): Response
public function edit(Request $request, Intern $intern,): Response
{
$form = $this->createForm(InternType::class, $intern);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$entityManager->flush();
$this->entityManager->flush();
return $this->redirectToRoute('app_intern_index', [], Response::HTTP_SEE_OTHER);
}
@ -55,18 +71,18 @@ final class InternController extends AbstractController
}
#[Route('/{id}', name: 'app_intern_delete', methods: ['POST'])]
public function delete(Request $request, Intern $intern, EntityManagerInterface $entityManager): Response
public function delete(Request $request, Intern $intern,): Response
{
if ($this->isCsrfTokenValid('delete'.$intern->getId(), $request->getPayload()->getString('_token'))) {
$entityManager->remove($intern);
$entityManager->flush();
$this->entityManager->remove($intern);
$this->entityManager->flush();
}
return $this->redirectToRoute('app_intern_index', [], Response::HTTP_SEE_OTHER);
}
#[Route('/degrees/add', name:'app_intern_add_degrees', methods:['POST'])]
public function addDegrees(Request $request, EntityManagerInterface $entityManager): Response
public function addDegrees(Request $request): Response
{
$intern = $this->getUser();
@ -81,17 +97,14 @@ final class InternController extends AbstractController
return $this->redirectToRoute('app_degree_index');
}
$degreeRepository = $entityManager->getRepository(Degree::class);
$internDegreeRepository = $entityManager->getRepository(InternDegree::class);
foreach ($selectedDegreeIds as $degreeId) {
$degree = $degreeRepository->find($degreeId);
$degree = $this->degreeRepository->find($degreeId);
if (!$degree) {
continue;
}
$existingInternDegree = $internDegreeRepository->findOneBy([
$existingInternDegree = $this->internDegreeRepository->findOneBy([
'intern' => $intern,
'degree' => $degree
]);
@ -102,11 +115,11 @@ final class InternController extends AbstractController
$internDegree->setDegree($degree);
$internDegree->setGraduationDate(new \DateTime());
$entityManager->persist($internDegree);
$this->entityManager->persist($internDegree);
}
}
$entityManager->flush();
$this->entityManager->flush();
$this->addFlash('success', 'Les diplômes ont été ajoutés avec succès.');
@ -114,20 +127,17 @@ final class InternController extends AbstractController
}
#[Route('/application/send', name:'app_intern_send_application', methods:['POST'])]
public function sendApplication(Request $request, EntityManagerInterface $entityManager): Response
public function sendApplication(Request $request,): Response
{
$intern = $this->getUser();
if (!$intern instanceof Intern) {
throw $this->createAccessDeniedException("Seuls les stagiaires peuvent envoyer des candidatures.");
}
$announcementRepository = $entityManager->getRepository(Announcement::class);
$internApplicationRepository = $entityManager->getRepository(InternApplication::class);
$announcementId = $request->request->get('announcement_id');
$announcement = $announcementRepository->find($announcementId);
$announcement = $this->announcementRepository->find($announcementId);
$existingInternApplication = $internApplicationRepository->findOneBy([
$existingInternApplication = $this->internApplicationRepository->findOneBy([
'intern' => $intern,
'application' => $announcement
]);
@ -139,9 +149,9 @@ final class InternController extends AbstractController
$internApplication->setApplicationDate(new \DateTime());
$internApplication->setStatus("En Attente");
$entityManager->persist($internApplication);
$this->entityManager->persist($internApplication);
}
$entityManager->flush();
$this->entityManager->flush();
$this->addFlash('success', 'La candidature à bien été envoyée.');
@ -150,7 +160,7 @@ final class InternController extends AbstractController
}
#[Route('/skills/add', name:'app_intern_add_skills', methods:['POST'])]
public function addSkills(Request $request, EntityManagerInterface $entityManager): Response
public function addSkills(Request $request,): Response
{
$intern = $this->getUser();
@ -165,15 +175,12 @@ final class InternController extends AbstractController
return $this->redirectToRoute('app_skill_index');
}
$skillRepository = $entityManager->getRepository(Skill::class);
$internSkillRepository = $entityManager->getRepository(InternSkill::class);
foreach ($selectedSkillIds as $skillId) {
$skill = $skillRepository->find($skillId);
$skill = $this->skillRepository->find($skillId);
if (!$skill) continue;
$existingInternSkill = $internSkillRepository->findOneBy([
$existingInternSkill = $this->internSkillRepository->findOneBy([
'intern' => $intern,
'skill' => $skill
]);
@ -183,11 +190,11 @@ final class InternController extends AbstractController
$internSkill->setIntern($intern);
$internSkill->setSkill($skill);
$entityManager->persist($internSkill);
$this->entityManager->persist($internSkill);
}
}
$entityManager->flush();
$this->entityManager->flush();
$this->addFlash('success', 'Les compétences ont été ajoutées avec succès.');

View File

@ -5,7 +5,9 @@ namespace App\Controller;
use App\Entity\Announcement;
use App\Entity\Intern;
use App\Entity\InternFavorite;
use App\Repository\AnnouncementRepository;
use App\Repository\InternFavoriteRepository;
use App\Repository\InternRepository;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Bundle\SecurityBundle\Security;
@ -17,69 +19,69 @@ use Symfony\Component\HttpFoundation\Response;
class InternFavoriteController extends AbstractController
{
public function __construct(
private readonly EntityManagerInterface $entityManager,
private readonly InternFavoriteRepository $internFavoriteRepository,
){}
#[Route('/favorite/toggle/{id}', name: 'toggle_favorite')]
public function toggleFavorite(
Announcement $announcement,
EntityManagerInterface $em,
InternFavoriteRepository $repo
): RedirectResponse {
$intern = $this->getUser()->getIntern();
public function toggleFavorite(Announcement $announcement): RedirectResponse {
$intern = $this->getUser();
$existing = $repo->findOneBy([
$existing = $this->internFavoriteRepository->findOneBy([
'intern' => $intern,
'announcement' => $announcement
]);
if ($existing) {
$em->remove($existing);
$this->entityManager->remove($existing);
} else {
$favorite = new InternFavorite();
$favorite->setIntern($intern);
$favorite->setAnnouncement($announcement);
$em->persist($favorite);
$this->entityManager->persist($favorite);
}
$em->flush();
$this->entityManager->flush();
return $this->redirectToRoute('app_announcement_index');
}
#[Route('/announcement/{id}/favorite/toggle', name: 'app_favorite_toggle', methods: ['POST'])]
public function toggle(Announcement $announcement, EntityManagerInterface $em, Security $security): RedirectResponse
public function toggle(Announcement $announcement,Security $security): RedirectResponse
{
$user = $security->getUser();
$user = $this->getUser();
if (!$user instanceof Intern) {
throw new AccessDeniedHttpException('Seuls les stagiaires peuvent ajouter aux favoris.');
}
$favorite = $em->getRepository(InternFavorite::class)->findOneBy([
$favorite = $this->entityManager->getRepository(InternFavorite::class)->findOneBy([
'intern' => $user,
'announcement' => $announcement
]);
if ($favorite) {
$em->remove($favorite);
$this->entityManager->remove($favorite);
} else {
$favorite = new InternFavorite();
$favorite->setIntern($user);
$favorite->setAnnouncement($announcement);
$em->persist($favorite);
$this->entityManager->persist($favorite);
}
$em->flush();
$this->entityManager->flush();
return new RedirectResponse($_SERVER['HTTP_REFERER'] ?? '/');
}
#[Route('/announcement/{id}', name: 'app_announcement_show')]
public function show(Announcement $announcement, InternFavoriteRepository $internFavoriteRepository): Response
public function show(Announcement $announcement,): Response
{
$user = $this->getUser();
$isFavorite = false;
if (in_array('ROLE_INTERN', $user->getRoles())) {
$favorite = $internFavoriteRepository->findOneBy([
$favorite = $this->internFavoriteRepository->findOneBy([
'announcement' => $announcement,
'intern' => $user,
]);
@ -94,12 +96,12 @@ class InternFavoriteController extends AbstractController
}
#[Route('/favorite/add/{id}', name: 'app_favorite_add')]
public function addFavorite(Announcement $announcement, EntityManagerInterface $entityManager): Response
public function addFavorite(Announcement $announcement,): Response
{
$user = $this->getUser();
// Vérifier si l'intern a déjà ce favori
$existingFavorite = $entityManager->getRepository(InternFavorite::class)->findOneBy([
$existingFavorite = $this->entityManager->getRepository(InternFavorite::class)->findOneBy([
'announcement' => $announcement,
'intern' => $user,
]);
@ -109,26 +111,26 @@ class InternFavoriteController extends AbstractController
$favorite->setAnnouncement($announcement);
$favorite->setIntern($user);
$entityManager->persist($favorite);
$entityManager->flush();
$this->entityManager->persist($favorite);
$this->entityManager->flush();
}
return $this->redirectToRoute('app_announcement_show', ['id' => $announcement->getId()]);
}
#[Route('/favorite/remove/{id}', name: 'app_favorite_remove')]
public function removeFavorite(Announcement $announcement, EntityManagerInterface $entityManager): Response
public function removeFavorite(Announcement $announcement,): Response
{
$user = $this->getUser();
$favorite = $entityManager->getRepository(InternFavorite::class)->findOneBy([
$favorite = $this->entityManager->getRepository(InternFavorite::class)->findOneBy([
'announcement' => $announcement,
'intern' => $user,
]);
if ($favorite) {
$entityManager->remove($favorite);
$entityManager->flush();
$this->entityManager->remove($favorite);
$this->entityManager->flush();
}
return $this->redirectToRoute('app_announcement_show', ['id' => $announcement->getId()]);

View File

@ -5,22 +5,33 @@ namespace App\Controller;
use App\Entity\Message;
use App\Entity\UserApp;
use App\Form\MessageType;
use App\Repository\AnnouncementRepository;
use App\Repository\InternSkillRepository;
use App\Repository\MessageRepository;
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\HttpKernel\Exception\AccessDeniedHttpException;
use Symfony\Component\Routing\Attribute\Route;
#[Route('/message')]
final class MessageController extends AbstractController
{
public function __construct(
private readonly EntityManagerInterface $entityManager,
private readonly MessageRepository $messageRepository,
private readonly UserRepository $userRepository,
){}
#[Route(name: 'app_message_index', methods: ['GET'])]
public function index(MessageRepository $messageRepository): Response
public function index(): Response
{
$user = $this->getUser();
$messages = $messageRepository->findLatestMessagesByUser($user);
if (!$user instanceof UserApp) {
throw new AccessDeniedHttpException("erreur");
}
$messages = $this->messageRepository->findLatestMessagesByUser($user);
return $this->render('message/index.html.twig', [
'messages' => $messages,
@ -28,12 +39,12 @@ final class MessageController extends AbstractController
}
#[Route('/conversation/{id}', name: 'app_message_conversation', methods: ['GET'])]
public function conversation(Message $message, MessageRepository $messageRepository): Response
public function conversation(Message $message,): Response
{
$user = $this->getUser();
$otherUser = $message->getSender() === $user ? $message->getReceiver() : $message->getSender();
$conversation = $messageRepository->findByConversation($user, $otherUser);
$conversation = $this->messageRepository->findByConversation($user, $otherUser);
return $this->render('message/conversation.html.twig', [
'conversation' => $conversation,
@ -44,12 +55,12 @@ final class MessageController extends AbstractController
#[Route('/new/{receiverId}', name: 'app_message_new', methods: ['GET', 'POST'])]
public function new(Request $request, EntityManagerInterface $entityManager, ?int $receiverId = null, UserRepository $userRepository): Response
public function new(Request $request, ?int $receiverId = null,): Response
{
$message = new Message();
if ($receiverId) {
$receiver = $userRepository->find($receiverId);
$receiver = $this->userRepository->find($receiverId);
if ($receiver) {
$message->setReceiver($receiver);
}
@ -62,8 +73,8 @@ final class MessageController extends AbstractController
$message->setSendingDate(new \DateTime());
$message->setSender($this->getUser());
$entityManager->persist($message);
$entityManager->flush();
$this->entityManager->persist($message);
$this->entityManager->flush();
return $this->redirectToRoute('app_message_index');
}
@ -82,14 +93,14 @@ final class MessageController extends AbstractController
}
#[Route('/{id}/edit', name: 'app_message_edit', methods: ['GET', 'POST'])]
public function edit(Request $request, Message $message, EntityManagerInterface $entityManager): Response
public function edit(Request $request, Message $message,): Response
{
$form = $this->createForm(MessageType::class, $message);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$message->setSendingDate(new \DateTime());
$entityManager->flush();
$this->entityManager->flush();
return $this->redirectToRoute('app_message_index', [], Response::HTTP_SEE_OTHER);
}
@ -101,11 +112,11 @@ final class MessageController extends AbstractController
}
#[Route('/{id}', name: 'app_message_delete', methods: ['POST'])]
public function delete(Request $request, Message $message, EntityManagerInterface $entityManager): Response
public function delete(Request $request, Message $message,): Response
{
if ($this->isCsrfTokenValid('delete'.$message->getId(), $request->getPayload()->getString('_token'))) {
$entityManager->remove($message);
$entityManager->flush();
$this->entityManager->remove($message);
$this->entityManager->flush();
}
return $this->redirectToRoute('app_message_index', [], Response::HTTP_SEE_OTHER);

View File

@ -7,6 +7,7 @@ use App\Entity\Intern;
use App\Entity\InternApplication;
use App\Entity\UserApp;
use App\Form\UserAppType;
use App\Repository\InternApplicationRepository;
use App\Repository\SkillRepository;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
@ -16,8 +17,12 @@ use Symfony\Component\Routing\Attribute\Route;
class ProfileController extends AbstractController
{
public function __construct(
private readonly EntityManagerInterface $entityManager,
private readonly InternApplicationRepository $internApplicationRepository,
){}
#[Route('/profile', name: 'app_profile')]
public function profile(EntityManagerInterface $entityManager): Response
public function profile(): Response
{
$user = $this->getUser();
@ -27,9 +32,8 @@ class ProfileController extends AbstractController
if ($user instanceof Intern)
{
$internApplicationRepository = $entityManager->getRepository(InternApplication::class);
$internApplications = $internApplicationRepository->findBy([
$internApplications = $this->internApplicationRepository->findBy([
'intern' => $user,
]);
@ -46,13 +50,13 @@ class ProfileController extends AbstractController
}
#[Route('profile/{id}/edit', name: 'app_profile_edit', methods: ['GET', 'POST'])]
public function edit(Request $request, UserApp $userApp, EntityManagerInterface $entityManager): Response
public function edit(Request $request, UserApp $userApp,): Response
{
$form = $this->createForm(UserAppType::class, $userApp);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$entityManager->flush();
$this->entityManager->flush();
return $this->redirectToRoute('app_profile', [], Response::HTTP_SEE_OTHER);
}
@ -63,17 +67,17 @@ class ProfileController extends AbstractController
]);
}
#[Route('/profile/{id}/visit', name: 'app_profile_visit')]
public function visitProfile(EntityManagerInterface $entityManager, int $id): Response
#[Route('/profile/visit/{id}', name: 'app_profile_visit')]
public function visitProfile(int $id): Response
{
$user = $entityManager->getRepository(Intern::class)->find($id);
$candidat = $this->entityManager->getRepository(Intern::class)->find($id);
if (!$user) {
if (!$candidat) {
throw $this->createNotFoundException('Utilisateur non trouvé.');
}
return $this->render('profile/index.html.twig', [
'user' => $user,
return $this->render('profile/visit.html.twig', [
'candidat' => $candidat,
]);
}

View File

@ -6,19 +6,25 @@ use App\Entity\Employee;
use App\Entity\Intern;
use App\Entity\UserApp;
use App\Form\RegistrationFormType;
use App\Repository\InternApplicationRepository;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Bundle\SecurityBundle\Security;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface;
use Symfony\Component\Routing\Attribute\Route;
use App\Entity\Company;
#[Route('/register', name: 'app_register')]
class RegistrationController extends AbstractController
{
public function __construct(
private readonly EntityManagerInterface $entityManager,
){}
#[Route('/', name: '_intern')]
public function register(Request $request, UserPasswordHasherInterface $userPasswordHasher, Security $security, EntityManagerInterface $entityManager): Response
public function register(Request $request, UserPasswordHasherInterface $userPasswordHasher, Security $security): Response
{
$user = new Intern();
$form = $this->createForm(RegistrationFormType::class, $user);
@ -32,44 +38,52 @@ class RegistrationController extends AbstractController
// encode the plain password
$user->setPassword($userPasswordHasher->hashPassword($user, $plainPassword));
$entityManager->persist($user);
$entityManager->flush();
// do anything else you need here, like send an email
$this->entityManager->persist($user);
$this->entityManager->flush();
return $security->login($user, 'form_login', 'main');
}
return $this->render('registration/register.html.twig', [
'registrationForm' => $form,
'employee' => False,
]);
}
#[Route('/employee', name: '_employee')]
public function registerEmployee(Request $request, UserPasswordHasherInterface $userPasswordHasher, Security $security, EntityManagerInterface $entityManager): Response
public function registerEmployee(Request $request, UserPasswordHasherInterface $userPasswordHasher, Security $security): Response
{
$user = new Employee();
$form = $this->createForm(RegistrationFormType::class, $user);
$form = $this->createForm(RegistrationFormType::class, $user)
->add('company', EntityType::class, [
'class' => Company::class,
'choice_label' => 'name',
'placeholder' => 'Sélectionnez une entreprise',
'label' => 'Entreprise',
]);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
/** @var string $plainPassword */
$plainPassword = $form->get('plainPassword')->getData();
$company = $form->get('company')->getData();
$user->setCompany($company);
$user->setRoles(['ROLE_EMPLOYEE']);
// encode the plain password
// Encoder le mot de passe
$user->setPassword($userPasswordHasher->hashPassword($user, $plainPassword));
$entityManager->persist($user);
$entityManager->flush();
// do anything else you need here, like send an email
$this->entityManager->persist($user);
$this->entityManager->flush();
return $security->login($user, 'form_login', 'main');
}
return $this->render('registration/register.html.twig', [
'registrationForm' => $form,
'employee' => True,
]);
}
}

View File

@ -2,7 +2,9 @@
namespace App\Controller;
use App\Repository\InternApplicationRepository;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Bundle\SecurityBundle\Security;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;

View File

@ -4,6 +4,8 @@ namespace App\Controller;
use App\Entity\Skill;
use App\Form\SkillType;
use App\Repository\AnnouncementRepository;
use App\Repository\InternApplicationRepository;
use App\Repository\SkillRepository;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
@ -15,25 +17,29 @@ use Symfony\Component\Security\Http\Attribute\IsGranted;
#[Route('/skill')]
final class SkillController extends AbstractController
{
public function __construct(
private readonly EntityManagerInterface $entityManager,
private readonly AnnouncementRepository $skillRepository,
){}
#[Route(name: 'app_skill_index', methods: ['GET'])]
public function index(SkillRepository $skillRepository): Response
public function index(): Response
{
return $this->render('skill/index.html.twig', [
'skills' => $skillRepository->findAll(),
'skills' => $this->skillRepository->findAll(),
]);
}
#[Route('/new', name: 'app_skill_new', methods: ['GET', 'POST'])]
#[IsGranted('ROLE_ADMIN')]
public function new(Request $request, EntityManagerInterface $entityManager): Response
public function new(Request $request,): Response
{
$skill = new Skill();
$form = $this->createForm(SkillType::class, $skill);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$entityManager->persist($skill);
$entityManager->flush();
$this->entityManager->persist($skill);
$this->entityManager->flush();
return $this->redirectToRoute('app_skill_index', [], Response::HTTP_SEE_OTHER);
}
@ -54,13 +60,13 @@ final class SkillController extends AbstractController
#[Route('/{id}/edit', name: 'app_skill_edit', methods: ['GET', 'POST'])]
#[IsGranted('ROLE_ADMIN')]
public function edit(Request $request, Skill $skill, EntityManagerInterface $entityManager): Response
public function edit(Request $request, Skill $skill,): Response
{
$form = $this->createForm(SkillType::class, $skill);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$entityManager->flush();
$this->entityManager->flush();
return $this->redirectToRoute('app_skill_index', [], Response::HTTP_SEE_OTHER);
}
@ -73,11 +79,11 @@ final class SkillController extends AbstractController
#[Route('/{id}', name: 'app_skill_delete', methods: ['POST'])]
#[IsGranted('ROLE_ADMIN')]
public function delete(Request $request, Skill $skill, EntityManagerInterface $entityManager): Response
public function delete(Request $request, Skill $skill,): Response
{
if ($this->isCsrfTokenValid('delete'.$skill->getId(), $request->getPayload()->getString('_token'))) {
$entityManager->remove($skill);
$entityManager->flush();
$this->entityManager->remove($skill);
$this->entityManager->flush();
}
return $this->redirectToRoute('app_skill_index', [], Response::HTTP_SEE_OTHER);

View File

@ -4,6 +4,7 @@ namespace App\Controller;
use App\Entity\UserApp;
use App\Form\UserAppType;
use App\Repository\AnnouncementRepository;
use App\Repository\UserRepository;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
@ -14,11 +15,15 @@ use Symfony\Component\Routing\Attribute\Route;
#[Route('/user')]
final class UserAppController extends AbstractController
{
public function __construct(
private readonly EntityManagerInterface $entityManager,
private readonly UserRepository $userRepository,
){}
#[Route(name: 'app_user_index', methods: ['GET'])]
public function index(UserRepository $userRepository): Response
public function index(): Response
{
return $this->render('user_app/index.html.twig', [
'user_apps' => $userRepository->findAll(),
'user_apps' => $this->userRepository->findAll(),
]);
}
@ -31,13 +36,13 @@ final class UserAppController extends AbstractController
}
#[Route('/{id}/edit', name: 'app_user_edit', methods: ['GET', 'POST'])]
public function edit(Request $request, UserApp $userApp, EntityManagerInterface $entityManager): Response
public function edit(Request $request, UserApp $userApp,): Response
{
$form = $this->createForm(UserAppType::class, $userApp);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$entityManager->flush();
$this->entityManager->flush();
return $this->redirectToRoute('app_user_index', [], Response::HTTP_SEE_OTHER);
}
@ -49,11 +54,11 @@ final class UserAppController extends AbstractController
}
#[Route('/{id}', name: 'app_user_delete', methods: ['POST'])]
public function delete(Request $request, UserApp $userApp, EntityManagerInterface $entityManager): Response
public function delete(Request $request, UserApp $userApp,): Response
{
if ($this->isCsrfTokenValid('delete'.$userApp->getId(), $request->getPayload()->getString('_token'))) {
$entityManager->remove($userApp);
$entityManager->flush();
$this->entityManager->remove($userApp);
$this->entityManager->flush();
}
return $this->redirectToRoute('app_user_index', [], Response::HTTP_SEE_OTHER);

View File

@ -1,57 +0,0 @@
<?php
namespace App\Entity;
use App\Repository\AnnonceRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: AnnonceRepository::class)]
class Annonce
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $Titre = null;
#[ORM\Column(length: 255)]
private ?string $Description = null;
public function getId(): ?int
{
return $this->id;
}
public function setId(int $id): static
{
$this->id = $id;
return $this;
}
public function getTitre(): ?string
{
return $this->Titre;
}
public function setTitre(string $Titre): static
{
$this->Titre = $Titre;
return $this;
}
public function getDescription(): ?string
{
return $this->Description;
}
public function setDescription(string $Description): static
{
$this->Description = $Description;
return $this;
}
}

View File

@ -7,6 +7,7 @@ use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: CompanyRepository::class)]
class Company
{

View File

@ -1,42 +0,0 @@
<?php
namespace App\Entity;
use App\Repository\CompetenceRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: CompetenceRepository::class)]
class Competence
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $Libelle = null;
public function getId(): ?int
{
return $this->id;
}
public function setId(int $id): static
{
$this->id = $id;
return $this;
}
public function getLibelle(): ?string
{
return $this->Libelle;
}
public function setLibelle(string $Libelle): static
{
$this->Libelle = $Libelle;
return $this;
}
}

View File

@ -1,65 +0,0 @@
<?php
namespace App\Entity;
use App\Repository\DemandeurRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: DemandeurRepository::class)]
class Demandeur
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $LM = null;
#[ORM\Column(length: 255)]
private ?string $CV = null;
#[ORM\Column(length: 255)]
private ?string $Mail = null;
public function getId(): ?int
{
return $this->id;
}
public function getLM(): ?string
{
return $this->LM;
}
public function setLM(string $LM): static
{
$this->LM = $LM;
return $this;
}
public function getCV(): ?string
{
return $this->CV;
}
public function setCV(string $CV): static
{
$this->CV = $CV;
return $this;
}
public function getMail(): ?string
{
return $this->Mail;
}
public function setMail(string $Mail): static
{
$this->Mail = $Mail;
return $this;
}
}

View File

@ -1,42 +0,0 @@
<?php
namespace App\Entity;
use App\Repository\DiplomeRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: DiplomeRepository::class)]
class Diplome
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $Libelle = null;
public function getId(): ?int
{
return $this->id;
}
public function setId(int $id): static
{
$this->id = $id;
return $this;
}
public function getLibelle(): ?string
{
return $this->Libelle;
}
public function setLibelle(string $Libelle): static
{
$this->Libelle = $Libelle;
return $this;
}
}

View File

@ -1,35 +0,0 @@
<?php
namespace App\Entity;
use App\Repository\EmployeRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: EmployeRepository::class)]
class Employe
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $Mail = null;
public function getId(): ?int
{
return $this->id;
}
public function getMail(): ?string
{
return $this->Mail;
}
public function setMail(string $Mail): static
{
$this->Mail = $Mail;
return $this;
}
}

View File

@ -1,87 +0,0 @@
<?php
namespace App\Entity;
use App\Repository\EntrepriseRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: EntrepriseRepository::class)]
class Entreprise
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $Nom = null;
#[ORM\Column(length: 255)]
private ?string $Adresse = null;
#[ORM\Column(length: 255)]
private ?string $Tel = null;
#[ORM\Column(length: 255)]
private ?string $Mail = null;
public function getId(): ?int
{
return $this->id;
}
public function setId(int $id): static
{
$this->id = $id;
return $this;
}
public function getNom(): ?string
{
return $this->Nom;
}
public function setNom(string $Nom): static
{
$this->Nom = $Nom;
return $this;
}
public function getAdresse(): ?string
{
return $this->Adresse;
}
public function setAdresse(string $Adresse): static
{
$this->Adresse = $Adresse;
return $this;
}
public function getTel(): ?string
{
return $this->Tel;
}
public function setTel(string $Tel): static
{
$this->Tel = $Tel;
return $this;
}
public function getMail(): ?string
{
return $this->Mail;
}
public function setMail(string $Mail): static
{
$this->Mail = $Mail;
return $this;
}
}

View File

@ -1,52 +0,0 @@
<?php
namespace App\Entity;
use App\Entity\UserApp;
use App\Entity\Announcement;
use App\Repository\FavorisRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: FavorisRepository::class)]
class Favoris
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\ManyToOne(inversedBy: 'favoris')]
#[ORM\JoinColumn(nullable: false)]
private ?UserApp $user = null;
#[ORM\ManyToOne(inversedBy: 'favoris')]
#[ORM\JoinColumn(nullable: false)]
private ?Announcement $announcement = null;
public function getId(): ?int
{
return $this->id;
}
public function getUser(): ?UserApp
{
return $this->user;
}
public function setUser(?UserApp $user): static
{
$this->user = $user;
return $this;
}
public function getAnnouncement(): ?Announcement
{
return $this->announcement;
}
public function setAnnouncement(?Announcement $announcement): static
{
$this->announcement = $announcement;
return $this;
}
}

View File

@ -1,36 +0,0 @@
<?php
namespace App\Entity;
use App\Repository\FormulaireRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: FormulaireRepository::class)]
class Formulaire
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(type: Types::DATE_MUTABLE)]
private ?\DateTimeInterface $Date = null;
public function getId(): ?int
{
return $this->id;
}
public function getDate(): ?\DateTimeInterface
{
return $this->Date;
}
public function setDate(\DateTimeInterface $Date): static
{
$this->Date = $Date;
return $this;
}
}

View File

@ -7,6 +7,7 @@ use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use App\Entity\Company;
#[ORM\Entity(repositoryClass: InternRepository::class)]
class Intern extends UserApp

View File

@ -1,36 +0,0 @@
<?php
namespace App\Entity;
use App\Repository\ListeRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: ListeRepository::class)]
class Liste
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(type: Types::DATE_MUTABLE)]
private ?\DateTimeInterface $Date = null;
public function getId(): ?int
{
return $this->id;
}
public function getDate(): ?\DateTimeInterface
{
return $this->Date;
}
public function setDate(\DateTimeInterface $Date): static
{
$this->Date = $Date;
return $this;
}
}

View File

@ -1,78 +0,0 @@
<?php
namespace App\Entity;
use App\Repository\StatusRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: StatusRepository::class)]
class Status
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $label = null;
/**
* @var Collection<int, Announcement>
*/
#[ORM\OneToMany(targetEntity: Announcement::class, mappedBy: 'status')]
private Collection $announcements;
public function __construct()
{
$this->announcements = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getLabel(): ?string
{
return $this->label;
}
public function setLabel(string $label): static
{
$this->label = $label;
return $this;
}
/**
* @return Collection<int, Announcement>
*/
public function getAnnouncements(): Collection
{
return $this->announcements;
}
public function addAnnouncement(Announcement $announcement): static
{
if (!$this->announcements->contains($announcement)) {
$this->announcements->add($announcement);
$announcement->setStatus($this);
}
return $this;
}
public function removeAnnouncement(Announcement $announcement): static
{
if ($this->announcements->removeElement($announcement)) {
// set the owning side to null (unless already changed)
if ($announcement->getStatus() === $this) {
$announcement->setStatus(null);
}
}
return $this;
}
}

View File

@ -10,7 +10,7 @@ use Symfony\Component\Security\Core\User\UserInterface;
#[ORM\Entity(repositoryClass: UserRepository::class)]
#[ORM\Table(name: 'userApp')]
#[ORM\InheritanceType('JOINED')]
#[ORM\InheritanceType('SINGLE_TABLE')]
#[ORM\DiscriminatorColumn(name: 'DISCRIMINATOR', type: 'string')]
#[ORM\DiscriminatorMap(['employee' => Employee::class, 'intern' => Intern::class])]
#[ORM\UniqueConstraint(name: 'UNIQ_IDENTIFIER_NICKNAME', fields: ['nickname'])]
@ -186,6 +186,7 @@ class UserApp implements UserInterface, PasswordAuthenticatedUserInterface
return $this;
}
}

View File

@ -1,135 +0,0 @@
<?php
namespace App\Entity;
use App\Repository\UtilisateurRepository;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
#[ORM\Entity(repositoryClass: UtilisateurRepository::class)]
class Utilisateur
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $Nom = null;
#[ORM\Column(length: 255)]
private ?string $Prenom = null;
#[ORM\Column(length: 255)]
private ?string $Tel = null;
#[ORM\Column(length: 255)]
private ?string $Adresse = null;
// Ajout de la relation OneToMany
#[ORM\OneToMany(targetEntity: Message::class, mappedBy: 'utilisateur')]
private Collection $messages;
public function __construct()
{
$this->messages = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function setId(int $id): static
{
$this->id = $id;
return $this;
}
public function getNom(): ?string
{
return $this->Nom;
}
public function setNom(string $Nom): static
{
$this->Nom = $Nom;
return $this;
}
public function getPrenom(): ?string
{
return $this->Prenom;
}
public function setPrenom(string $Prenom): static
{
$this->Prenom = $Prenom;
return $this;
}
public function getTel(): ?string
{
return $this->Tel;
}
public function setTel(string $Tel): static
{
$this->Tel = $Tel;
return $this;
}
public function getAdresse(): ?string
{
return $this->Adresse;
}
public function setAdresse(string $Adresse): static
{
$this->Adresse = $Adresse;
return $this;
}
// Getter et setter pour la relation avec Message
/**
* @return Collection<int, Message>
*/
public function getMessages(): Collection
{
return $this->messages;
}
public function addMessage(Message $message): static
{
if (!$this->messages->contains($message)) {
$this->messages[] = $message;
$message->setUtilisateur($this);
}
return $this;
}
public function removeMessage(Message $message): static
{
if ($this->messages->removeElement($message)) {
if ($message->getUtilisateur() === $this) {
$message->setUtilisateur(null);
}
}
return $this;
}
}

View File

@ -1,42 +0,0 @@
<?php
namespace App\Entity;
use App\Repository\VerifieRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: VerifieRepository::class)]
class Verifie
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $Libelle = null;
public function getId(): ?int
{
return $this->id;
}
public function setId(int $id): static
{
$this->id = $id;
return $this;
}
public function getLibelle(): ?string
{
return $this->Libelle;
}
public function setLibelle(string $Libelle): static
{
$this->Libelle = $Libelle;
return $this;
}
}

View File

@ -15,12 +15,19 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Validator\Constraints\IsTrue;
use Symfony\Component\Validator\Constraints\Length;
use Symfony\Component\Validator\Constraints\NotBlank;
use App\Entity\Company;
use App\Entity\Intern;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Doctrine\ORM\EntityRepository;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
class RegistrationFormType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('nickname', TextType::class, [
'label' => 'Utilisateur : ',
])
@ -45,10 +52,7 @@ class RegistrationFormType extends AbstractType
new NotBlank(),
]
])
//
->add('plainPassword', PasswordType::class, [
// instead of being set onto the object directly,
// this is read and encoded in the controller
'mapped' => false,
'attr' => ['autocomplete' => 'new-password'],
'constraints' => [
@ -58,12 +62,10 @@ class RegistrationFormType extends AbstractType
new Length([
'min' => 6,
'minMessage' => 'Votre mot de passe doit avoir au moins {{ limit }} caractères',
// max length allowed by Symfony for security reasons
'max' => 4096,
]),
],
])
;
]);
}
public function configureOptions(OptionsResolver $resolver): void

View File

@ -1,43 +0,0 @@
<?php
namespace App\Repository;
use App\Entity\Annonce;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<Annonce>
*/
class AnnonceRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Annonce::class);
}
// /**
// * @return Annonce[] Returns an array of Annonce objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('a')
// ->andWhere('a.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('a.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?Annonce
// {
// return $this->createQueryBuilder('a')
// ->andWhere('a.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}

View File

@ -1,43 +0,0 @@
<?php
namespace App\Repository;
use App\Entity\Competence;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<Competence>
*/
class CompetenceRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Competence::class);
}
// /**
// * @return Competence[] Returns an array of Competence objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('c')
// ->andWhere('c.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('c.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?Competence
// {
// return $this->createQueryBuilder('c')
// ->andWhere('c.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}

View File

@ -1,43 +0,0 @@
<?php
namespace App\Repository;
use App\Entity\Demandeur;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<Demandeur>
*/
class DemandeurRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Demandeur::class);
}
// /**
// * @return Demandeur[] Returns an array of Demandeur objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('d')
// ->andWhere('d.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('d.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?Demandeur
// {
// return $this->createQueryBuilder('d')
// ->andWhere('d.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}

View File

@ -1,43 +0,0 @@
<?php
namespace App\Repository;
use App\Entity\Diplome;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<Diplome>
*/
class DiplomeRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Diplome::class);
}
// /**
// * @return Diplome[] Returns an array of Diplome objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('d')
// ->andWhere('d.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('d.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?Diplome
// {
// return $this->createQueryBuilder('d')
// ->andWhere('d.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}

View File

@ -1,43 +0,0 @@
<?php
namespace App\Repository;
use App\Entity\Employe;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<Employe>
*/
class EmployeRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Employe::class);
}
// /**
// * @return Employe[] Returns an array of Employe objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('e')
// ->andWhere('e.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('e.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?Employe
// {
// return $this->createQueryBuilder('e')
// ->andWhere('e.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}

View File

@ -1,43 +0,0 @@
<?php
namespace App\Repository;
use App\Entity\Entreprise;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<Entreprise>
*/
class EntrepriseRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Entreprise::class);
}
// /**
// * @return Entreprise[] Returns an array of Entreprise objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('e')
// ->andWhere('e.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('e.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?Entreprise
// {
// return $this->createQueryBuilder('e')
// ->andWhere('e.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}

View File

@ -1,43 +0,0 @@
<?php
namespace App\Repository;
use App\Entity\Favoris;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<Favoris>
*/
class FavorisRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Favoris::class);
}
// /**
// * @return Favoris[] Returns an array of Favoris objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('f')
// ->andWhere('f.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('f.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?Favoris
// {
// return $this->createQueryBuilder('f')
// ->andWhere('f.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}

View File

@ -1,43 +0,0 @@
<?php
namespace App\Repository;
use App\Entity\Formulaire;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<Formulaire>
*/
class FormulaireRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Formulaire::class);
}
// /**
// * @return Formulaire[] Returns an array of Formulaire objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('f')
// ->andWhere('f.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('f.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?Formulaire
// {
// return $this->createQueryBuilder('f')
// ->andWhere('f.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}

View File

@ -1,43 +0,0 @@
<?php
namespace App\Repository;
use App\Entity\Liste;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<Liste>
*/
class ListeRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Liste::class);
}
// /**
// * @return Liste[] Returns an array of Liste objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('l')
// ->andWhere('l.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('l.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?Liste
// {
// return $this->createQueryBuilder('l')
// ->andWhere('l.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}

View File

@ -1,43 +0,0 @@
<?php
namespace App\Repository;
use App\Entity\Status;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<Status>
*/
class StatusRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Status::class);
}
// /**
// * @return Status[] Returns an array of Status objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('v')
// ->andWhere('v.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('v.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?Status
// {
// return $this->createQueryBuilder('v')
// ->andWhere('v.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}

View File

@ -1,43 +0,0 @@
<?php
namespace App\Repository;
use App\Entity\Utilisateur;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<Utilisateur>
*/
class UtilisateurRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Utilisateur::class);
}
// /**
// * @return Utilisateur[] Returns an array of Utilisateur objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('u')
// ->andWhere('u.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('u.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?Utilisateur
// {
// return $this->createQueryBuilder('u')
// ->andWhere('u.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}

View File

@ -1,43 +0,0 @@
<?php
namespace App\Repository;
use App\Entity\Verifie;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<Verifie>
*/
class VerifieRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Verifie::class);
}
// /**
// * @return Verifie[] Returns an array of Verifie objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('v')
// ->andWhere('v.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('v.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?Verifie
// {
// return $this->createQueryBuilder('v')
// ->andWhere('v.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}

View File

@ -3,22 +3,41 @@
{% block title %}Liste des Candidatures{% endblock %}
{% block body %}
<h2 class="text-2xl font-bold mb-6">Candidatures reçues</h2>
<div class="max-w-2xl mx-auto mt-8">
<h2 class="text-3xl font-semibold text-center mb-8 text-gray-800">Candidatures reçues</h2>
{% for app in applications %}
<div class="border border-gray-300 rounded-lg p-4 mb-4 shadow-sm bg-white">
<p><strong>Annonce :</strong> {{ app.application.title }}</p>
<p><strong>Candidat :</strong> {{ app.intern.firstName }} {{ app.intern.lastName }}</p>
<p><strong>Date :</strong> {{ app.applicationDate|date('d/m/Y') }}</p>
<p><strong>Statut :</strong> {{ app.status }}</p>
{% for app in applications %}
<div class="border border-gray-200 rounded-2xl p-6 shadow-md bg-white space-y-2">
<p><span class="font-semibold text-gray-700">Annonce :</span> {{ app.application.title }}</p>
<p><span class="font-semibold text-gray-700">Candidat :</span> {{ app.intern.firstName }} {{ app.intern.lastName }}</p>
<p><span class="font-semibold text-gray-700">Date :</span> {{ app.applicationDate|date('d/m/Y') }}</p>
<p><span class="font-semibold text-gray-700">Statut :</span> {{ app.status|capitalize }}</p>
<a href="{{ path('app_profile_visit', { id: app.intern.id }) }}"
class="inline-block mt-2 bg-teal-500 hover:bg-teal-600 text-white px-4 py-2 rounded">
Voir le profil du candidat
</a>
<a href="{{ path('app_profile_visit', { id: app.intern.id }) }}"
class="inline-block mt-3 bg-teal-500 hover:bg-teal-600 text-white px-4 py-2 rounded shadow">
Voir le profil du candidat
</a>
{% if app.status == 'En Attente' %}
<div class="flex justify-end gap-3 mt-4">
<form method="post" action="{{ path('app_employee_update_application_status',
{id: app.id, status: 'Acceptée'}) }}">
<button type="submit" class="bg-green-500 hover:bg-green-600 text-white px-4 py-2 rounded shadow">
Accepter
</button>
</form>
<form method="post" action="{{ path('app_employee_update_application_status',
{id: app.id, status: 'Refusée'}) }}">
<button type="submit" class="bg-red-500 hover:bg-red-600 text-white px-4 py-2 rounded shadow">
Refuser
</button>
</form>
</div>
{% endif %}
</div>
{% else %}
<p class="text-center text-gray-600">Aucune candidature pour le moment.</p>
{% endfor %}
</div>
{% else %}
<p>Aucune candidature pour le moment.</p>
{% endfor %}
{% endblock %}

View File

@ -8,9 +8,9 @@
<p class="text-gray-600">Téléphone : {{ app.user.tel }}</p>
<p class="text-gray-600">Email : {{ app.user.mail }}</p>
<a href="{{ path('app_employee_seeApplications') }}"
class="bg-blue-600 hover:bg-blue-700 text-white py-2 px-4 rounded">
Voir les candidatures reçues
<a class="bg-teal-500 hover:bg-teal-600 text-white py-2 px-4 rounded-full"
href="{{ path('app_employee_seeApplications') }}"> Voir les candidatures reçues
</a>

View File

@ -7,18 +7,18 @@
<h2 class="text-2xl font-bold mb-4">Profil du candidat</h2>
<div class="mb-4">
<p><strong>Nom :</strong> {{ user.lastName }}</p>
<p><strong>Prénom :</strong> {{ user.firstName }}</p>
<p><strong>Email :</strong> {{ user.mail }}</p>
<p><strong>Téléphone :</strong> {{ user.tel }}</p>
<p><strong>Adresse :</strong> {{ user.address }}</p>
<p><strong>Nom :</strong> {{ candidat.lastName }}</p>
<p><strong>Prénom :</strong> {{ candidat.firstName }}</p>
<p><strong>Email :</strong> {{ candidat.mail }}</p>
<p><strong>Téléphone :</strong> {{ candidat.tel }}</p>
<p><strong>Adresse :</strong> {{ candidat.address }}</p>
</div>
<div class="mb-4">
<h3 class="text-xl font-semibold">Diplômes</h3>
<ul class="list-disc list-inside text-gray-800 mt-2">
{% if user.degrees|length > 0 %}
{% for deg in user.degrees %}
{% if candidat.degrees|length > 0 %}
{% for deg in candidat.degrees %}
<li>
{{ deg.degree.label }} — Obtenu le {{ deg.graduationDate|date('d/m/Y') }}
</li>
@ -32,9 +32,9 @@
<div class="mb-4">
<h3 class="text-xl font-semibold">Compétences</h3>
<ul class="list-disc list-inside text-gray-800 mt-2">
{% if user.skills|length > 0 %}
{% for skill in user.skills %}
<li>{{ skill.label }}</li>
{% if candidat.skills|length > 0 %}
{% for sk in candidat.skills %}
<li>{{ sk.skill.label }}</li>
{% endfor %}
{% else %}
<p class="text-gray-500 mt-2">Aucune compétence renseignée.</p>
@ -43,9 +43,9 @@
</div>
<div class="mt-6">
<a href="{{ path('app_index') }}"
<a href="{{ path('app_employee_seeApplications') }}"
class="bg-teal-500 hover:bg-teal-600 text-white py-2 px-4 rounded-full">
Retour à l'accueil
Retour à la liste des candidatures
</a>
</div>
</div>

View File

@ -36,6 +36,15 @@
{{ form_errors(registrationForm.mail) }}
</div>
{% if employee %}
<div class="mb-4">
{{ form_label(registrationForm.company, 'Sélectionnez une entreprise', {'label_attr': {'class': 'block text-gray-700 mb-2'}}) }}
{{ form_widget(registrationForm.company, {'attr': {'class': 'w-full px-4 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-teal-500'}}) }}
{{ form_errors(registrationForm.company) }}
</div>
{% endif %}
<!-- Mot de passe -->
<div class="mb-4">
{{ form_label(registrationForm.plainPassword, 'Mot de passe', {'label_attr': {'class': 'block text-gray-700 mb-2'}}) }}
{{ form_widget(registrationForm.plainPassword, {'attr': {'class': 'w-full px-4 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-teal-500'}}) }}