ya des entite tkt

This commit is contained in:
allavenavr 2024-10-17 17:56:46 +02:00 committed by barillote
parent a949b7b390
commit 071fcb41b4
21 changed files with 1155 additions and 13 deletions

5
.gitignore vendored
View File

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

View File

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

View File

@ -0,0 +1,67 @@
<?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 Version20241017134137 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('CREATE SEQUENCE announcement_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE company_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE userApp_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE TABLE announcement (id INT NOT NULL, title VARCHAR(255) NOT NULL, description VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE company (id INT NOT NULL, name VARCHAR(255) NOT NULL, address VARCHAR(255) NOT NULL, tel VARCHAR(255) NOT NULL, mail VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE employee (id INT NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE intern (id INT NOT NULL, cover_letter TEXT NOT NULL, resume VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE userApp (id INT NOT NULL, nickname VARCHAR(180) NOT NULL, roles JSON NOT NULL, password VARCHAR(255) NOT NULL, first_name VARCHAR(255) NOT NULL, last_name VARCHAR(255) NOT NULL, tel VARCHAR(255) NOT NULL, address VARCHAR(255) NOT NULL, mail VARCHAR(255) NOT NULL, DISCRIMINATOR VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_IDENTIFIER_NICKNAME ON userApp (nickname)');
$this->addSql('CREATE TABLE messenger_messages (id BIGSERIAL NOT NULL, body TEXT NOT NULL, headers TEXT NOT NULL, queue_name VARCHAR(190) NOT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, available_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, delivered_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_75EA56E0FB7336F0 ON messenger_messages (queue_name)');
$this->addSql('CREATE INDEX IDX_75EA56E0E3BD61CE ON messenger_messages (available_at)');
$this->addSql('CREATE INDEX IDX_75EA56E016BA31DB ON messenger_messages (delivered_at)');
$this->addSql('COMMENT ON COLUMN messenger_messages.created_at IS \'(DC2Type:datetime_immutable)\'');
$this->addSql('COMMENT ON COLUMN messenger_messages.available_at IS \'(DC2Type:datetime_immutable)\'');
$this->addSql('COMMENT ON COLUMN messenger_messages.delivered_at IS \'(DC2Type:datetime_immutable)\'');
$this->addSql('CREATE OR REPLACE FUNCTION notify_messenger_messages() RETURNS TRIGGER AS $$
BEGIN
PERFORM pg_notify(\'messenger_messages\', NEW.queue_name::text);
RETURN NEW;
END;
$$ LANGUAGE plpgsql;');
$this->addSql('DROP TRIGGER IF EXISTS notify_trigger ON messenger_messages;');
$this->addSql('CREATE TRIGGER notify_trigger AFTER INSERT OR UPDATE ON messenger_messages FOR EACH ROW EXECUTE PROCEDURE notify_messenger_messages();');
$this->addSql('ALTER TABLE employee ADD CONSTRAINT FK_5D9F75A1BF396750 FOREIGN KEY (id) REFERENCES userApp (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE intern ADD CONSTRAINT FK_A5795F36BF396750 FOREIGN KEY (id) REFERENCES userApp (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
}
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('DROP SEQUENCE announcement_id_seq CASCADE');
$this->addSql('DROP SEQUENCE company_id_seq CASCADE');
$this->addSql('DROP SEQUENCE userApp_id_seq CASCADE');
$this->addSql('ALTER TABLE employee DROP CONSTRAINT FK_5D9F75A1BF396750');
$this->addSql('ALTER TABLE intern DROP CONSTRAINT FK_A5795F36BF396750');
$this->addSql('DROP TABLE announcement');
$this->addSql('DROP TABLE company');
$this->addSql('DROP TABLE employee');
$this->addSql('DROP TABLE intern');
$this->addSql('DROP TABLE userApp');
$this->addSql('DROP TABLE messenger_messages');
}
}

View File

@ -0,0 +1,52 @@
<?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 Version20241017142722 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('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 announcement ADD company_id INT NOT NULL');
$this->addSql('ALTER TABLE announcement ADD status_id INT NOT NULL');
$this->addSql('ALTER TABLE announcement ADD CONSTRAINT FK_4DB9D91C979B1AD6 FOREIGN KEY (company_id) REFERENCES company (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE announcement ADD CONSTRAINT FK_4DB9D91C6BF700BD FOREIGN KEY (status_id) REFERENCES status (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('CREATE INDEX IDX_4DB9D91C979B1AD6 ON announcement (company_id)');
$this->addSql('CREATE INDEX IDX_4DB9D91C6BF700BD ON announcement (status_id)');
$this->addSql('ALTER TABLE employee ADD company_id INT NOT NULL');
$this->addSql('ALTER TABLE employee ADD CONSTRAINT FK_5D9F75A1979B1AD6 FOREIGN KEY (company_id) REFERENCES company (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('CREATE INDEX IDX_5D9F75A1979B1AD6 ON employee (company_id)');
}
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 announcement DROP CONSTRAINT FK_4DB9D91C6BF700BD');
$this->addSql('DROP SEQUENCE status_id_seq CASCADE');
$this->addSql('DROP TABLE status');
$this->addSql('ALTER TABLE announcement DROP CONSTRAINT FK_4DB9D91C979B1AD6');
$this->addSql('DROP INDEX IDX_4DB9D91C979B1AD6');
$this->addSql('DROP INDEX IDX_4DB9D91C6BF700BD');
$this->addSql('ALTER TABLE announcement DROP company_id');
$this->addSql('ALTER TABLE announcement DROP status_id');
$this->addSql('ALTER TABLE employee DROP CONSTRAINT FK_5D9F75A1979B1AD6');
$this->addSql('DROP INDEX IDX_5D9F75A1979B1AD6');
$this->addSql('ALTER TABLE employee DROP company_id');
}
}

View File

@ -0,0 +1,46 @@
<?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 Version20241017152949 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('CREATE TABLE favorites (intern_id INT NOT NULL, announcement_id INT NOT NULL, PRIMARY KEY(intern_id, announcement_id))');
$this->addSql('CREATE INDEX IDX_E46960F5525DD4B4 ON favorites (intern_id)');
$this->addSql('CREATE INDEX IDX_E46960F5913AEA17 ON favorites (announcement_id)');
$this->addSql('CREATE TABLE applications (intern_id INT NOT NULL, announcement_id INT NOT NULL, PRIMARY KEY(intern_id, announcement_id))');
$this->addSql('CREATE INDEX IDX_F7C966F0525DD4B4 ON applications (intern_id)');
$this->addSql('CREATE INDEX IDX_F7C966F0913AEA17 ON applications (announcement_id)');
$this->addSql('ALTER TABLE favorites ADD CONSTRAINT FK_E46960F5525DD4B4 FOREIGN KEY (intern_id) REFERENCES intern (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE favorites ADD CONSTRAINT FK_E46960F5913AEA17 FOREIGN KEY (announcement_id) REFERENCES announcement (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE applications ADD CONSTRAINT FK_F7C966F0525DD4B4 FOREIGN KEY (intern_id) REFERENCES intern (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE applications ADD CONSTRAINT FK_F7C966F0913AEA17 FOREIGN KEY (announcement_id) REFERENCES announcement (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
}
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 favorites DROP CONSTRAINT FK_E46960F5525DD4B4');
$this->addSql('ALTER TABLE favorites DROP CONSTRAINT FK_E46960F5913AEA17');
$this->addSql('ALTER TABLE applications DROP CONSTRAINT FK_F7C966F0525DD4B4');
$this->addSql('ALTER TABLE applications DROP CONSTRAINT FK_F7C966F0913AEA17');
$this->addSql('DROP TABLE favorites');
$this->addSql('DROP TABLE applications');
}
}

156
src/Entity/Announcement.php Normal file
View File

@ -0,0 +1,156 @@
<?php
namespace App\Entity;
use App\Repository\AnnouncementRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
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\ManyToOne(inversedBy: 'announcements')]
#[ORM\JoinColumn(nullable: false)]
private ?Status $status = null;
/**
* @var Collection<int, Intern>
*/
#[ORM\ManyToMany(targetEntity: Intern::class, mappedBy: 'favorites')]
private Collection $internsfav;
/**
* @var Collection<int, Intern>
*/
#[ORM\ManyToMany(targetEntity: Intern::class, mappedBy: 'applications')]
private Collection $applicants;
public function __construct()
{
$this->internsfav = new ArrayCollection();
$this->applicants = 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(): ?Status
{
return $this->status;
}
public function setStatus(?Status $status): static
{
$this->status = $status;
return $this;
}
/**
* @return Collection<int, Intern>
*/
public function getInternsfav(): Collection
{
return $this->internsfav;
}
public function addInternfav(Intern $intern): static
{
if (!$this->internsfav->contains($intern)) {
$this->internsfav->add($intern);
$intern->addFavorite($this);
}
return $this;
}
public function removeInternfav(Intern $intern): static
{
if ($this->internsfav->removeElement($intern)) {
$intern->removeFavorite($this);
}
return $this;
}
/**
* @return Collection<int, Intern>
*/
public function getApplicants(): Collection
{
return $this->applicants;
}
public function addApplicant(Intern $applicant): static
{
if (!$this->applicants->contains($applicant)) {
$this->applicants->add($applicant);
$applicant->addApplication($this);
}
return $this;
}
public function removeApplicant(Intern $applicant): static
{
if ($this->applicants->removeElement($applicant)) {
$applicant->removeApplication($this);
}
return $this;
}
}

161
src/Entity/Company.php Normal file
View File

@ -0,0 +1,161 @@
<?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;
}
}

26
src/Entity/Employee.php Normal file
View File

@ -0,0 +1,26 @@
<?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: false)]
private ?Company $company = null;
public function getCompany(): ?Company
{
return $this->company;
}
public function setCompany(?Company $company): static
{
$this->company = $company;
return $this;
}
}

143
src/Entity/Intern.php Normal file
View File

@ -0,0 +1,143 @@
<?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)]
private ?string $coverLetter = null;
#[ORM\Column(length: 255)]
private ?string $resume = null;
/**
* @var Collection<int, Announcement>
*/
#[ORM\ManyToMany(targetEntity: Announcement::class, inversedBy: 'interns')]
#[ORM\JoinTable(name: 'favorites')]
private Collection $favorites;
/**
* @var Collection<int, Announcement>
*/
#[ORM\ManyToMany(targetEntity: Announcement::class, inversedBy: 'applicants')]
#[ORM\JoinTable(name: 'applications')]
private Collection $applications;
/**
* @var Collection<int, Skill>
*/
#[ORM\ManyToMany(targetEntity: Skill::class, inversedBy: 'interns')]
private Collection $skills;
public function __construct()
{
$this->favorites = new ArrayCollection();
$this->applications = new ArrayCollection();
$this->skills = 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, Announcement>
*/
public function getFavorites(): Collection
{
return $this->favorites;
}
public function addFavorite(Announcement $favorite): static
{
if (!$this->favorites->contains($favorite)) {
$this->favorites->add($favorite);
}
return $this;
}
public function removeFavorite(Announcement $favorite): static
{
$this->favorites->removeElement($favorite);
return $this;
}
/**
* @return Collection<int, Announcement>
*/
public function getApplications(): Collection
{
return $this->applications;
}
public function addApplication(Announcement $application): static
{
if (!$this->applications->contains($application)) {
$this->applications->add($application);
}
return $this;
}
public function removeApplication(Announcement $application): static
{
$this->applications->removeElement($application);
return $this;
}
/**
* @return Collection<int, Skill>
*/
public function getSkills(): Collection
{
return $this->skills;
}
public function addSkill(Skill $skill): static
{
if (!$this->skills->contains($skill)) {
$this->skills->add($skill);
}
return $this;
}
public function removeSkill(Skill $skill): static
{
$this->skills->removeElement($skill);
return $this;
}
}

36
src/Entity/Obtaining.php Normal file
View File

@ -0,0 +1,36 @@
<?php
namespace App\Entity;
use App\Repository\ObtainingRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: ObtainingRepository::class)]
class Obtaining
{
#[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;
}
}

75
src/Entity/Skill.php Normal file
View File

@ -0,0 +1,75 @@
<?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, Intern>
*/
#[ORM\ManyToMany(targetEntity: Intern::class, mappedBy: 'skills')]
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, Intern>
*/
public function getInterns(): Collection
{
return $this->interns;
}
public function addIntern(Intern $intern): static
{
if (!$this->interns->contains($intern)) {
$this->interns->add($intern);
$intern->addSkill($this);
}
return $this;
}
public function removeIntern(Intern $intern): static
{
if ($this->interns->removeElement($intern)) {
$intern->removeSkill($this);
}
return $this;
}
}

78
src/Entity/Status.php Normal file
View File

@ -0,0 +1,78 @@
<?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

@ -8,9 +8,12 @@ use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
use Symfony\Component\Security\Core\User\UserInterface; use Symfony\Component\Security\Core\User\UserInterface;
#[ORM\Entity(repositoryClass: UserRepository::class)] #[ORM\Entity(repositoryClass: UserRepository::class)]
#[ORM\Table(name: '`user`')] #[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'])] #[ORM\UniqueConstraint(name: 'UNIQ_IDENTIFIER_NICKNAME', fields: ['nickname'])]
class User implements UserInterface, PasswordAuthenticatedUserInterface class UserApp implements UserInterface, PasswordAuthenticatedUserInterface
{ {
#[ORM\Id] #[ORM\Id]
#[ORM\GeneratedValue] #[ORM\GeneratedValue]

View File

@ -0,0 +1,43 @@
<?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

@ -0,0 +1,43 @@
<?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

@ -0,0 +1,43 @@
<?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

@ -0,0 +1,43 @@
<?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

@ -0,0 +1,43 @@
<?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

@ -0,0 +1,43 @@
<?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

@ -0,0 +1,43 @@
<?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

@ -2,7 +2,7 @@
namespace App\Repository; namespace App\Repository;
use App\Entity\User; use App\Entity\UserApp;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry; use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\Security\Core\Exception\UnsupportedUserException; use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
@ -10,13 +10,13 @@ use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
use Symfony\Component\Security\Core\User\PasswordUpgraderInterface; use Symfony\Component\Security\Core\User\PasswordUpgraderInterface;
/** /**
* @extends ServiceEntityRepository<User> * @extends ServiceEntityRepository<UserApp>
*/ */
class UserRepository extends ServiceEntityRepository implements PasswordUpgraderInterface class UserRepository extends ServiceEntityRepository implements PasswordUpgraderInterface
{ {
public function __construct(ManagerRegistry $registry) public function __construct(ManagerRegistry $registry)
{ {
parent::__construct($registry, User::class); parent::__construct($registry, UserApp::class);
} }
/** /**
@ -24,7 +24,7 @@ class UserRepository extends ServiceEntityRepository implements PasswordUpgrader
*/ */
public function upgradePassword(PasswordAuthenticatedUserInterface $user, string $newHashedPassword): void public function upgradePassword(PasswordAuthenticatedUserInterface $user, string $newHashedPassword): void
{ {
if (!$user instanceof User) { if (!$user instanceof UserApp) {
throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', $user::class)); throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', $user::class));
} }
@ -34,7 +34,7 @@ class UserRepository extends ServiceEntityRepository implements PasswordUpgrader
} }
// /** // /**
// * @return User[] Returns an array of User objects // * @return UserApp[] Returns an array of UserApp objects
// */ // */
// public function findByExampleField($value): array // public function findByExampleField($value): array
// { // {
@ -48,7 +48,7 @@ class UserRepository extends ServiceEntityRepository implements PasswordUpgrader
// ; // ;
// } // }
// public function findOneBySomeField($value): ?User // public function findOneBySomeField($value): ?UserApp
// { // {
// return $this->createQueryBuilder('u') // return $this->createQueryBuilder('u')
// ->andWhere('u.exampleField = :val') // ->andWhere('u.exampleField = :val')