Compare commits

..

No commits in common. "esteban" and "master" have entirely different histories.

43 changed files with 8 additions and 2477 deletions

4
.gitignore vendored
View File

@ -14,10 +14,12 @@
.phpunit.result.cache
###< phpunit/phpunit ###
###> symfony/phpunit-bridge ###
.phpunit.result.cache
/phpunit.xml
###< symfony/phpunit-bridge ###
###> symfony/asset-mapper ###
/public/assets/
/assets/vendor/
###< symfony/asset-mapper ###
.idea

8
.idea/.gitignore vendored
View File

@ -1,8 +0,0 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View File

@ -43,8 +43,7 @@
"symfony/web-link": "7.1.*",
"symfony/yaml": "7.1.*",
"twig/extra-bundle": "^2.12|^3.0",
"twig/twig": "^2.12|^3.0",
"ext-http": "*"
"twig/twig": "^2.12|^3.0"
},
"config": {
"allow-plugins": {

View File

@ -1,47 +1,17 @@
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'
# 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)
app_intern_provider:
entity:
class: App\Entity\Intern
property: nickname
app_employee_provider:
entity:
class: App\Entity\Employee
property: nickname
# used to reload user from session & other features (e.g. switch_user)
# used to reload user from session & other features (e.g. switch_user)
users_in_memory: { memory: null }
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
intern:
main:
lazy: true
provider: app_intern_provider
form_login:
login_path: app_login
check_path: app_login
enable_csrf: true
logout:
path: app_logout
# where to redirect after logout
# target: app_any_route
employee:
lazy: true
provider: app_employee_provider
form_login:
login_path: app_login
check_path: app_login
enable_csrf: true
logout:
path: app_logout
# where to redirect after logout
# target: app_any_route
provider: users_in_memory
# activate different ways to authenticate
# https://symfony.com/doc/current/security.html#the-firewall

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 Version20241121153037 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,84 +0,0 @@
<?php
namespace App\Controller;
use App\Entity\Announcement;
use App\Form\AnnouncementType;
use App\Repository\AnnouncementRepository;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
#[Route('/announcement', name: 'app_announcement')]
class AnnouncementController extends AbstractController
{
public function __construct(
private readonly EntityManagerInterface $entityManager,
private readonly AnnouncementRepository $announcementRepository
)
{
}
#[Route('/add', name: '_add')]
public function addAnnouncement(Request $request): Response
{
$announcement = new Announcement();
$form = $this->createForm(AnnouncementType::class, $announcement);
$form->handleRequest($request);
if($form->isSubmitted() && $form->isValid())
{
//met la date de création de l'annonce au moment où le formulaire est envoyé
$announcement->setCreationDate(new \DateTime());
$this->entityManager->persist($announcement);
$this->entityManager->flush();
$this->addFlash('success', 'Annonce créée avec succès.');
return $this->redirectToRoute('app_announcement_list');
}
return $this->render('announcement/add.html.twig', [
'announcementForm' => $form,
]);
}
#[Route('/list', name: '_list')]
public function list(): Response
{
$announcements = $this->announcementRepository->findAll();
return $this->render('announcement/list.html.twig', [
'announcements' => $announcements,
]);
}
#[Route('/update/{id}', name: '_update')]
public function update(int $id, Request $request): Response
{
$announcement = $this->announcementRepository->find($id);
$form = $this->createForm(AnnouncementType::class, $announcement);
$form->handleRequest($request);
if($form->isSubmitted() && $form->isValid())
{
$this->entityManager->persist($announcement);
$this->entityManager->flush();
}
return $this->render('announcement/add.html.twig', [
'formAdd' => $form,
]);
}
#[Route('/delete/{id}', name: '_delete')]
public function delete(int $id): Response
{
$announcement = $this->announcementRepository->find($id);
$this->entityManager->remove($announcement);
$this->entityManager->flush();
return $this->redirectToRoute('app_announcement_list');
}
}

View File

@ -1,75 +0,0 @@
<?php
namespace App\Controller;
use App\Entity\Employee;
use App\Entity\Intern;
use App\Entity\UserApp;
use App\Form\RegistrationFormType;
use Doctrine\ORM\EntityManagerInterface;
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;
#[Route('/register', name: 'app_register')]
class RegistrationController extends AbstractController
{
#[Route('/intern', name: '_intern')]
public function register(Request $request, UserPasswordHasherInterface $userPasswordHasher, Security $security, EntityManagerInterface $entityManager): Response
{
$user = new Intern();
$form = $this->createForm(RegistrationFormType::class, $user);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
/** @var string $plainPassword */
$plainPassword = $form->get('plainPassword')->getData();
$user->setRoles(['ROLE_INTERN']);
// 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
return $security->login($user, 'form_login', 'intern');
}
return $this->render('registration/register.html.twig', [
'registrationForm' => $form,
]);
}
#[Route('/employee', name: '_employee')]
public function registerEmployee(Request $request, UserPasswordHasherInterface $userPasswordHasher, Security $security, EntityManagerInterface $entityManager): Response
{
$user = new Employee();
$form = $this->createForm(RegistrationFormType::class, $user);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
/** @var string $plainPassword */
$plainPassword = $form->get('plainPassword')->getData();
$user->setRoles(['ROLE_EMPLOYEE']);
// 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
return $security->login($user, 'form_login', 'employee');
}
return $this->render('registration/register.html.twig', [
'registrationForm' => $form,
]);
}
}

View File

@ -1,32 +0,0 @@
<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
class SecurityController extends AbstractController
{
#[Route(path: '/login', name: 'app_login')]
public function login(AuthenticationUtils $authenticationUtils): Response
{
// get the login error if there is one
$error = $authenticationUtils->getLastAuthenticationError();
// last username entered by the user
$lastUsername = $authenticationUtils->getLastUsername();
return $this->render('security/login.html.twig', [
'last_username' => $lastUsername,
'error' => $error,
]);
}
#[Route(path: '/logout', name: 'app_logout')]
public function logout(): void
{
throw new \LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.');
}
}

View File

@ -1,177 +0,0 @@
<?php
namespace App\Entity;
use App\Repository\AnnouncementRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: AnnouncementRepository::class)]
class Announcement
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $title = null;
#[ORM\Column(length: 255)]
private ?string $description = null;
#[ORM\ManyToOne(inversedBy: 'announcements')]
#[ORM\JoinColumn(nullable: false)]
private ?Company $company = null;
#[ORM\Column(nullable: false)]
private ?string $status = null;
/**
* @var ?Collection<int, InternApplication>
*/
#[ORM\OneToMany(targetEntity: InternApplication::class, mappedBy: 'application')]
private ?Collection $applicants;
/**
* @var ?Collection<int, InternFavorite>
*/
#[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();
$this->favoritesInterns = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(string $title): static
{
$this->title = $title;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(string $description): static
{
$this->description = $description;
return $this;
}
public function getCompany(): ?Company
{
return $this->company;
}
public function setCompany(?Company $company): static
{
$this->company = $company;
return $this;
}
public function getStatus(): ?string
{
return $this->status;
}
public function setStatus(?string $status): static
{
$this->status = $status;
return $this;
}
/**
* @return Collection<int, InternApplication>
*/
public function getApplicants(): Collection
{
return $this->applicants;
}
public function addApplicants(InternApplication $applicants): static
{
if (!$this->applicants->contains($applicants)) {
$this->applicants->add($applicants);
$applicants->setApplication($this);
}
return $this;
}
public function removeApplicants(InternApplication $applicants): static
{
if ($this->applicants->removeElement($applicants)) {
// set the owning side to null (unless already changed)
if ($applicants->getApplication() === $this) {
$applicants->setApplication(null);
}
}
return $this;
}
/**
* @return Collection<int, InternFavorite>
*/
public function getFavoritesInterns(): Collection
{
return $this->favoritesInterns;
}
public function addFavoritesIntern(InternFavorite $favoritesIntern): static
{
if (!$this->favoritesInterns->contains($favoritesIntern)) {
$this->favoritesInterns->add($favoritesIntern);
$favoritesIntern->setAnnouncement($this);
}
return $this;
}
public function removeFavoritesIntern(InternFavorite $favoritesIntern): static
{
if ($this->favoritesInterns->removeElement($favoritesIntern)) {
// set the owning side to null (unless already changed)
if ($favoritesIntern->getAnnouncement() === $this) {
$favoritesIntern->setAnnouncement(null);
}
}
return $this;
}
public function getCreationDate(): ?\DateTimeInterface
{
return $this->creationDate;
}
public function setCreationDate(\DateTimeInterface $creationDate): static
{
$this->creationDate = $creationDate;
return $this;
}
}

View File

@ -1,161 +0,0 @@
<?php
namespace App\Entity;
use App\Repository\CompanyRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: CompanyRepository::class)]
class Company
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $name = null;
#[ORM\Column(length: 255)]
private ?string $address = null;
#[ORM\Column(length: 255)]
private ?string $tel = null;
#[ORM\Column(length: 255)]
private ?string $mail = null;
/**
* @var Collection<int, Employee>
*/
#[ORM\OneToMany(targetEntity: Employee::class, mappedBy: 'company')]
private Collection $employees;
/**
* @var Collection<int, Announcement>
*/
#[ORM\OneToMany(targetEntity: Announcement::class, mappedBy: 'company')]
private Collection $announcements;
public function __construct()
{
$this->employees = new ArrayCollection();
$this->announcements = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): static
{
$this->name = $name;
return $this;
}
public function getAddress(): ?string
{
return $this->address;
}
public function setAddress(string $address): static
{
$this->address = $address;
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;
}
/**
* @return Collection<int, Employee>
*/
public function getEmployees(): Collection
{
return $this->employees;
}
public function addEmployee(Employee $employee): static
{
if (!$this->employees->contains($employee)) {
$this->employees->add($employee);
$employee->setCompany($this);
}
return $this;
}
public function removeEmployee(Employee $employee): static
{
if ($this->employees->removeElement($employee)) {
// set the owning side to null (unless already changed)
if ($employee->getCompany() === $this) {
$employee->setCompany(null);
}
}
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->setCompany($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->getCompany() === $this) {
$announcement->setCompany(null);
}
}
return $this;
}
}

View File

@ -1,78 +0,0 @@
<?php
namespace App\Entity;
use App\Repository\DegreeRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: DegreeRepository::class)]
class Degree
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $label = null;
/**
* @var Collection<int, InternDegree>
*/
#[ORM\OneToMany(targetEntity: InternDegree::class, mappedBy: 'degree')]
private Collection $interns;
public function __construct()
{
$this->interns = 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, InternDegree>
*/
public function getInterns(): Collection
{
return $this->interns;
}
public function addIntern(InternDegree $intern): static
{
if (!$this->interns->contains($intern)) {
$this->interns->add($intern);
$intern->setDegree($this);
}
return $this;
}
public function removeIntern(InternDegree $intern): static
{
if ($this->interns->removeElement($intern)) {
// set the owning side to null (unless already changed)
if ($intern->getDegree() === $this) {
$intern->setDegree(null);
}
}
return $this;
}
}

View File

@ -1,26 +0,0 @@
<?php
namespace App\Entity;
use App\Repository\EmployeeRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: EmployeeRepository::class)]
class Employee extends UserApp
{
#[ORM\ManyToOne(inversedBy: 'employees')]
#[ORM\JoinColumn(nullable: true)]
private ?Company $company = null;
public function getCompany(): ?Company
{
return $this->company;
}
public function setCompany(?Company $company): static
{
$this->company = $company;
return $this;
}
}

View File

@ -1,66 +0,0 @@
<?php
namespace App\Entity;
use App\Repository\FAQRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: FAQRepository::class)]
class FAQ
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(type: Types::TEXT)]
private ?string $question = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $answer = null;
#[ORM\Column(type: Types::DATE_MUTABLE)]
private ?\DateTimeInterface $updateDate = null;
public function getId(): ?int
{
return $this->id;
}
public function getQuestion(): ?string
{
return $this->question;
}
public function setQuestion(string $question): static
{
$this->question = $question;
return $this;
}
public function getAnswer(): ?string
{
return $this->answer;
}
public function setAnswer(?string $answer): static
{
$this->answer = $answer;
return $this;
}
public function getUpdateDate(): ?\DateTimeInterface
{
return $this->updateDate;
}
public function setUpdateDate(\DateTimeInterface $updateDate): static
{
$this->updateDate = $updateDate;
return $this;
}
}

View File

@ -1,196 +0,0 @@
<?php
namespace App\Entity;
use App\Repository\InternRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: InternRepository::class)]
class Intern extends UserApp
{
#[ORM\Column(type: Types::TEXT,nullable: true)]
private ?string $coverLetter = null;
#[ORM\Column(length: 255,nullable: true)]
private ?string $resume = null;
/**
* @var Collection<int, InternDegree>
*/
#[ORM\OneToMany(targetEntity: InternDegree::class, mappedBy: 'intern')]
private Collection $degrees;
/**
* @var Collection<int, InternSkill>
*/
#[ORM\OneToMany(targetEntity: InternSkill::class, mappedBy: 'intern')]
private Collection $skills;
/**
* @var Collection<int, InternApplication>
*/
#[ORM\OneToMany(targetEntity: InternApplication::class, mappedBy: 'intern')]
private Collection $applications;
/**
* @var Collection<int, InternFavorite>
*/
#[ORM\OneToMany(targetEntity: InternFavorite::class, mappedBy: 'intern')]
private Collection $favorites;
public function __construct()
{
$this->degrees = new ArrayCollection();
$this->skills = new ArrayCollection();
$this->applications = new ArrayCollection();
$this->favorites = new ArrayCollection();
}
public function getCoverLetter(): ?string
{
return $this->coverLetter;
}
public function setCoverLetter(string $coverLetter): static
{
$this->coverLetter = $coverLetter;
return $this;
}
public function getResume(): ?string
{
return $this->resume;
}
public function setResume(string $resume): static
{
$this->resume = $resume;
return $this;
}
/**
* @return Collection<int, InternDegree>
*/
public function getDegrees(): Collection
{
return $this->degrees;
}
public function addDegree(InternDegree $degree): static
{
if (!$this->degrees->contains($degree)) {
$this->degrees->add($degree);
$degree->setIntern($this);
}
return $this;
}
public function removeDegree(InternDegree $degree): static
{
if ($this->degrees->removeElement($degree)) {
// set the owning side to null (unless already changed)
if ($degree->getIntern() === $this) {
$degree->setIntern(null);
}
}
return $this;
}
/**
* @return Collection<int, InternSkill>
*/
public function getSkills(): Collection
{
return $this->skills;
}
public function addSkill(InternSkill $skill): static
{
if (!$this->skills->contains($skill)) {
$this->skills->add($skill);
$skill->setIntern($this);
}
return $this;
}
public function removeSkill(InternSkill $skill): static
{
if ($this->skills->removeElement($skill)) {
// set the owning side to null (unless already changed)
if ($skill->getIntern() === $this) {
$skill->setIntern(null);
}
}
return $this;
}
/**
* @return Collection<int, InternApplication>
*/
public function getApplications(): Collection
{
return $this->applications;
}
public function addApplication(InternApplication $application): static
{
if (!$this->applications->contains($application)) {
$this->applications->add($application);
$application->setIntern($this);
}
return $this;
}
public function removeApplication(InternApplication $application): static
{
if ($this->applications->removeElement($application)) {
// set the owning side to null (unless already changed)
if ($application->getIntern() === $this) {
$application->setIntern(null);
}
}
return $this;
}
/**
* @return Collection<int, InternFavorite>
*/
public function getFavorites(): Collection
{
return $this->favorites;
}
public function addFavorite(InternFavorite $favorite): static
{
if (!$this->favorites->contains($favorite)) {
$this->favorites->add($favorite);
$favorite->setIntern($this);
}
return $this;
}
public function removeFavorite(InternFavorite $favorite): static
{
if ($this->favorites->removeElement($favorite)) {
// set the owning side to null (unless already changed)
if ($favorite->getIntern() === $this) {
$favorite->setIntern(null);
}
}
return $this;
}
}

View File

@ -1,66 +0,0 @@
<?php
namespace App\Entity;
use App\Repository\InternApplicationRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: InternApplicationRepository::class)]
class InternApplication
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\ManyToOne(inversedBy: 'applicants')]
private ?Announcement $application = null;
#[ORM\ManyToOne(inversedBy: 'applications')]
private ?Intern $intern = null;
#[ORM\Column(type: Types::DATE_MUTABLE)]
private ?\DateTimeInterface $applicationDate = null;
public function getId(): ?int
{
return $this->id;
}
public function getApplication(): ?Announcement
{
return $this->application;
}
public function setApplication(?Announcement $application): static
{
$this->application = $application;
return $this;
}
public function getIntern(): ?Intern
{
return $this->intern;
}
public function setIntern(?Intern $intern): static
{
$this->intern = $intern;
return $this;
}
public function getApplicationDate(): ?\DateTimeInterface
{
return $this->applicationDate;
}
public function setApplicationDate(\DateTimeInterface $applicationDate): static
{
$this->applicationDate = $applicationDate;
return $this;
}
}

View File

@ -1,66 +0,0 @@
<?php
namespace App\Entity;
use App\Repository\InternDegreeRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: InternDegreeRepository::class)]
class InternDegree
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\ManyToOne(inversedBy: 'interns')]
private ?Degree $degree = null;
#[ORM\ManyToOne(inversedBy: 'degrees')]
private ?Intern $intern = null;
#[ORM\Column(type: Types::DATE_MUTABLE)]
private ?\DateTimeInterface $graduationDate = null;
public function getId(): ?int
{
return $this->id;
}
public function getDegree(): ?Degree
{
return $this->degree;
}
public function setDegree(?Degree $degree): static
{
$this->degree = $degree;
return $this;
}
public function getIntern(): ?Intern
{
return $this->intern;
}
public function setIntern(?Intern $intern): static
{
$this->intern = $intern;
return $this;
}
public function getGraduationDate(): ?\DateTimeInterface
{
return $this->graduationDate;
}
public function setGraduationDate(\DateTimeInterface $graduationDate): static
{
$this->graduationDate = $graduationDate;
return $this;
}
}

View File

@ -1,50 +0,0 @@
<?php
namespace App\Entity;
use App\Repository\InternFavoriteRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: InternFavoriteRepository::class)]
class InternFavorite
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\ManyToOne(inversedBy: 'favoritesInterns')]
private ?Announcement $announcement = null;
#[ORM\ManyToOne(inversedBy: 'favorites')]
private ?Intern $intern = null;
public function getId(): ?int
{
return $this->id;
}
public function getAnnouncement(): ?Announcement
{
return $this->announcement;
}
public function setAnnouncement(?Announcement $announcement): static
{
$this->announcement = $announcement;
return $this;
}
public function getIntern(): ?Intern
{
return $this->intern;
}
public function setIntern(?Intern $intern): static
{
$this->intern = $intern;
return $this;
}
}

View File

@ -1,50 +0,0 @@
<?php
namespace App\Entity;
use App\Repository\InternSkillRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: InternSkillRepository::class)]
class InternSkill
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\ManyToOne(inversedBy: 'interns')]
private ?Skill $skill = null;
#[ORM\ManyToOne(inversedBy: 'skills')]
private ?Intern $intern = null;
public function getId(): ?int
{
return $this->id;
}
public function getSkill(): ?Skill
{
return $this->skill;
}
public function setSkill(?Skill $skill): static
{
$this->skill = $skill;
return $this;
}
public function getIntern(): ?Intern
{
return $this->intern;
}
public function setIntern(?Intern $intern): static
{
$this->intern = $intern;
return $this;
}
}

View File

@ -1,81 +0,0 @@
<?php
namespace App\Entity;
use App\Repository\MessageRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: MessageRepository::class)]
class Message
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\ManyToOne]
private ?UserApp $sender = null;
#[ORM\ManyToOne]
private ?UserApp $receiver = null;
#[ORM\Column(type: Types::TEXT)]
private ?string $content = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
private ?\DateTimeInterface $sendingDate = null;
public function getId(): ?int
{
return $this->id;
}
public function getSender(): ?UserApp
{
return $this->sender;
}
public function setSender(?UserApp $sender): static
{
$this->sender = $sender;
return $this;
}
public function getReceiver(): ?UserApp
{
return $this->receiver;
}
public function setReceiver(?UserApp $receiver): static
{
$this->receiver = $receiver;
return $this;
}
public function getContent(): ?string
{
return $this->content;
}
public function setContent(string $content): static
{
$this->content = $content;
return $this;
}
public function getSendingDate(): ?\DateTimeInterface
{
return $this->sendingDate;
}
public function setSendingDate(\DateTimeInterface $sendingDate): static
{
$this->sendingDate = $sendingDate;
return $this;
}
}

View File

@ -1,78 +0,0 @@
<?php
namespace App\Entity;
use App\Repository\SkillRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: SkillRepository::class)]
class Skill
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $label = null;
/**
* @var Collection<int, InternSkill>
*/
#[ORM\OneToMany(targetEntity: InternSkill::class, mappedBy: 'skill')]
private Collection $interns;
public function __construct()
{
$this->interns = 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, InternSkill>
*/
public function getInterns(): Collection
{
return $this->interns;
}
public function addIntern(InternSkill $intern): static
{
if (!$this->interns->contains($intern)) {
$this->interns->add($intern);
$intern->setSkill($this);
}
return $this;
}
public function removeIntern(InternSkill $intern): static
{
if ($this->interns->removeElement($intern)) {
// set the owning side to null (unless already changed)
if ($intern->getSkill() === $this) {
$intern->setSkill(null);
}
}
return $this;
}
}

View File

@ -1,206 +0,0 @@
<?php
namespace App\Entity;
use App\Repository\UserRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
use Symfony\Component\Security\Core\User\UserInterface;
#[ORM\Entity(repositoryClass: UserRepository::class)]
#[ORM\Table(name: 'userApp')]
#[ORM\InheritanceType('JOINED')]
#[ORM\DiscriminatorColumn(name: 'DISCRIMINATOR', type: 'string')]
#[ORM\DiscriminatorMap(['employee' => Employee::class, 'intern' => Intern::class])]
#[ORM\UniqueConstraint(name: 'UNIQ_IDENTIFIER_NICKNAME', fields: ['nickname'])]
#[UniqueEntity(fields: ['nickname'], message: 'Il y a déjà un compte avec ces identifiants !')]
class UserApp implements UserInterface, PasswordAuthenticatedUserInterface
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 180)]
private ?string $nickname = null;
/**
* @var list<string> The user roles
*/
#[ORM\Column]
private array $roles = [];
/**
* @var string The hashed password
*/
#[ORM\Column]
private ?string $password = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $firstName = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $lastName = null;
#[ORM\Column(length: 255,nullable: true)]
private ?string $tel = null;
#[ORM\Column(length: 255,nullable: true)]
private ?string $address = null;
#[ORM\Column(length: 255,nullable: true)]
private ?string $mail = null;
#[ORM\Column(nullable: true)]
private bool $isVerified = false;
public function getId(): ?int
{
return $this->id;
}
public function getNickname(): ?string
{
return $this->nickname;
}
public function setNickname(string $nickname): static
{
$this->nickname = $nickname;
return $this;
}
/**
* A visual identifier that represents this user.
*
* @see UserInterface
*/
public function getUserIdentifier(): string
{
return (string) $this->nickname;
}
/**
* @see UserInterface
*
* @return list<string>
*/
public function getRoles(): array
{
$roles = $this->roles;
// guarantee every user at least has ROLE_USER
$roles[] = 'ROLE_USER';
return array_unique($roles);
}
/**
* @param list<string> $roles
*/
public function setRoles(array $roles): static
{
$this->roles = $roles;
return $this;
}
/**
* @see PasswordAuthenticatedUserInterface
*/
public function getPassword(): ?string
{
return $this->password;
}
public function setPassword(string $password): static
{
$this->password = $password;
return $this;
}
/**
* @see UserInterface
*/
public function eraseCredentials(): void
{
// If you store any temporary, sensitive data on the user, clear it here
// $this->plainPassword = null;
}
public function getFirstName(): ?string
{
return $this->firstName;
}
public function setFirstName(string $firstName): static
{
$this->firstName = $firstName;
return $this;
}
public function getLastName(): ?string
{
return $this->lastName;
}
public function setLastName(string $lastName): static
{
$this->lastName = $lastName;
return $this;
}
public function getTel(): ?string
{
return $this->tel;
}
public function setTel(string $tel): static
{
$this->tel = $tel;
return $this;
}
public function getAddress(): ?string
{
return $this->address;
}
public function setAddress(string $address): static
{
$this->address = $address;
return $this;
}
public function getMail(): ?string
{
return $this->mail;
}
public function setMail(string $mail): static
{
$this->mail = $mail;
return $this;
}
public function isVerified(): bool
{
return $this->isVerified;
}
public function setVerified(bool $isVerified): static
{
$this->isVerified = $isVerified;
return $this;
}
}

View File

@ -1,39 +0,0 @@
<?php
namespace App\Form;
use App\Entity\Announcement;
use App\Entity\Company;
use App\Entity\Status;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class AnnouncementType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('title')
->add('description')
->add('company', EntityType::class, [
'class' => Company::class,
'choice_label' => 'id',
])
->add('status', EntityType::class, [
'class' => Status::class,
'choice_label' => 'id',
])
->add('submit', SubmitType::class)
;
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Announcement::class,
]);
}
}

View File

@ -1,81 +0,0 @@
<?php
namespace App\Form;
use App\Entity\UserApp;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Validator\Constraints\IsTrue;
use Symfony\Component\Validator\Constraints\Length;
use Symfony\Component\Validator\Constraints\NotBlank;
class RegistrationFormType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('nickname', TextType::class, [
'label' => 'Utilisateur : ',
])
->add('firstname', TextType::class, [
'label' => 'Prénom : ',
'required' => true,
'constraints' => [
new NotBlank(),
]
])
->add('lastname', TextType::class, [
'label' => 'Nom : ',
'required' => true,
'constraints' => [
new NotBlank(),
]
])
->add('mail', EmailType::class, [
'label' => 'Email : ',
'required' => true,
'constraints' => [
new NotBlank(),
]
])
// ->add('agreeTerms', CheckboxType::class, [
// 'mapped' => false,
// 'constraints' => [
// new IsTrue([
// 'message' => 'Vous devez accepter les conditions d\'utilisation.',
// ]),
// ],
// ])
->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' => [
new NotBlank([
'message' => 'Merci d\'entrer votre mot de passe.',
]),
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
{
$resolver->setDefaults([
'data_class' => UserApp::class,
]);
}
}

View File

@ -1,43 +0,0 @@
<?php
namespace App\Repository;
use App\Entity\Announcement;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<Announcement>
*/
class AnnouncementRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Announcement::class);
}
// /**
// * @return Announcement[] Returns an array of Announcement 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): ?Announcement
// {
// 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\Company;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<Company>
*/
class CompanyRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Company::class);
}
// /**
// * @return Company[] Returns an array of Company 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): ?Company
// {
// 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\Degree;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<Degree>
*/
class DegreeRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Degree::class);
}
// /**
// * @return Degree[] Returns an array of Degree 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): ?Degree
// {
// 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\Employee;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<Employee>
*/
class EmployeeRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Employee::class);
}
// /**
// * @return Employee[] Returns an array of Employee 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): ?Employee
// {
// 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\FAQ;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<FAQ>
*/
class FAQRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, FAQ::class);
}
// /**
// * @return FAQ[] Returns an array of FAQ 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): ?FAQ
// {
// 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\InternApplication;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<InternApplication>
*/
class InternApplicationRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, InternApplication::class);
}
// /**
// * @return InternApplication[] Returns an array of InternApplication objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('i')
// ->andWhere('i.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('i.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?InternApplication
// {
// return $this->createQueryBuilder('i')
// ->andWhere('i.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,60 +0,0 @@
<?php
namespace App\Repository;
use App\Entity\UserApp;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
use Symfony\Component\Security\Core\User\PasswordUpgraderInterface;
/**
* @extends ServiceEntityRepository<UserApp>
*/
class UserRepository extends ServiceEntityRepository implements PasswordUpgraderInterface
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, UserApp::class);
}
/**
* Used to upgrade (rehash) the user's password automatically over time.
*/
public function upgradePassword(PasswordAuthenticatedUserInterface $user, string $newHashedPassword): void
{
if (!$user instanceof UserApp) {
throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', $user::class));
}
$user->setPassword($newHashedPassword);
$this->getEntityManager()->persist($user);
$this->getEntityManager()->flush();
}
// /**
// * @return UserApp[] Returns an array of UserApp 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): ?UserApp
// {
// return $this->createQueryBuilder('u')
// ->andWhere('u.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}

View File

@ -1,52 +0,0 @@
<?php
namespace App\Security;
use App\Entity\UserApp;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bridge\Twig\Mime\TemplatedEmail;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Mailer\MailerInterface;
use SymfonyCasts\Bundle\VerifyEmail\Exception\VerifyEmailExceptionInterface;
use SymfonyCasts\Bundle\VerifyEmail\VerifyEmailHelperInterface;
class EmailVerifier
{
public function __construct(
private VerifyEmailHelperInterface $verifyEmailHelper,
private MailerInterface $mailer,
private EntityManagerInterface $entityManager
) {
}
public function sendEmailConfirmation(string $verifyEmailRouteName, UserApp $user, TemplatedEmail $email): void
{
$signatureComponents = $this->verifyEmailHelper->generateSignature(
$verifyEmailRouteName,
(string) $user->getId(),
(string) $user->getMail()
);
$context = $email->getContext();
$context['signedUrl'] = $signatureComponents->getSignedUrl();
$context['expiresAtMessageKey'] = $signatureComponents->getExpirationMessageKey();
$context['expiresAtMessageData'] = $signatureComponents->getExpirationMessageData();
$email->context($context);
$this->mailer->send($email);
}
/**
* @throws VerifyEmailExceptionInterface
*/
public function handleEmailConfirmation(Request $request, UserApp $user): void
{
$this->verifyEmailHelper->validateEmailConfirmationFromRequest($request, (string) $user->getId(), (string) $user->getMail());
$user->setVerified(true);
$this->entityManager->persist($user);
$this->entityManager->flush();
}
}

View File

@ -1,14 +0,0 @@
{% extends 'base.html.twig' %}
{% block title %}Hello AnnouncementController!{% endblock %}
{% block body %}
<style>
.example-wrapper { margin: 1em auto; max-width: 800px; width: 95%; font: 18px/1.5 sans-serif; }
.example-wrapper code { background: #F5F5F5; padding: 2px 6px; }
</style>
{{ form(announcementForm) }}
{% endblock %}

View File

@ -1,20 +0,0 @@
{% extends 'base.html.twig' %}
{% block title %}Hello AnnouncementController!{% endblock %}
{% block body %}
<style>
.example-wrapper { margin: 1em auto; max-width: 800px; width: 95%; font: 18px/1.5 sans-serif; }
.example-wrapper code { background: #F5F5F5; padding: 2px 6px; }
</style>
<div class="example-wrapper">
<h1>Hello {{ controller_name }}! ✅</h1>
This friendly message is coming from:
<ul>
<li>Your controller at <code>C:/Users/csese/Romain/Phpstorm_projets/ProjetHegreSphere/hegresphere/src/Controller/AnnouncementController.php</code></li>
<li>Your template at <code>C:/Users/csese/Romain/Phpstorm_projets/ProjetHegreSphere/hegresphere/templates/announcement/index.html.twig</code></li>
</ul>
</div>
{% endblock %}

View File

@ -1,21 +0,0 @@
{% extends 'base.html.twig' %}
{% block title %}Bienvenue sur Hegreshpere{% endblock %}
{% block body %}
<style>
.example-wrapper { margin: 1em auto; max-width: 800px; width: 95%; font: 18px/1.5 sans-serif; }
.example-wrapper code { background: #F5F5F5; padding: 2px 6px; }
</style>
<h1> Liste des annonces</h1>
{% for ann in announcements %}
<h2> {{ ann.title }} </h2>
<h3> {{ ann.company.name }} </h3>
<p> {{ ann.description }} </p>
<p> {{ ann.creationDate }} </p>
{% endfor %}
{% endblock %}

View File

@ -1,22 +0,0 @@
{% extends 'base.html.twig' %}
{% block title %}Inscription{% endblock %}
{% block body %}
<h1>Inscription</h1>
{{ form_errors(registrationForm) }}
{{ form_start(registrationForm) }}
{{ form_row(registrationForm.nickname) }}
{{ form_row(registrationForm.firstname) }}
{{ form_row(registrationForm.lastname) }}
{{ form_row(registrationForm.mail) }}
{{ form_row(registrationForm.plainPassword, {
label: 'Password'
}) }}
{# {{ form_row(registrationForm.agreeTerms) }}#}
<button type="submit" class="btn">S'inscrire</button>
{{ form_end(registrationForm) }}
{% endblock %}

View File

@ -1,41 +0,0 @@
{% extends 'base.html.twig' %}
{% block title %}Connexion{% endblock %}
{% block body %}
<form method="post">
{% if error %}
<div class="alert alert-danger">{{ error.messageKey|trans(error.messageData, 'security') }}</div>
{% endif %}
{% if app.user %}
<div class="mb-3">
You are logged in as {{ app.user.userIdentifier }}, <a href="{{ path('app_logout') }}">Logout</a>
</div>
{% endif %}
<h1 class="h3 mb-3 font-weight-normal">Connexion à votre compte</h1>
<label for="username">Nom d'utilisateur</label>
<input type="text" value="{{ last_username }}" name="_username" id="username" class="form-control" autocomplete="username" required autofocus>
<label for="password">Mot de passe</label>
<input type="password" name="_password" id="password" class="form-control" autocomplete="current-password" required>
<input type="hidden" name="_csrf_token"
value="{{ csrf_token('authenticate') }}"
>
{#
Uncomment this section and add a remember_me option below your firewall to activate remember me functionality.
See https://symfony.com/doc/current/security/remember_me.html
<div class="checkbox mb-3">
<input type="checkbox" name="_remember_me" id="_remember_me">
<label for="_remember_me">Remember me</label>
</div>
#}
<button class="btn btn-lg btn-primary" type="submit">
Connexion
</button>
</form>
{% endblock %}