src/Entity/School.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\SchoolRepository;
  4. use App\Validatior\Constraints as IFEFAssert;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. #[ORM\Table(name'school')]
  9. #[ORM\Entity(repositoryClassSchoolRepository::class)]
  10. #[ORM\HasLifecycleCallbacks]
  11. class School {
  12.     #[ORM\Id]
  13.     #[ORM\GeneratedValue]
  14.     #[ORM\Column(type'integer')]
  15.     private ?int $id null;
  16.     #[ORM\Column(name'created_date'type'datetime'nullabletrue)]
  17.     private ?\DateTime $createdDate null;
  18.     #[ORM\Column(name'updated_date'type'datetime'nullabletrue)]
  19.     private ?\DateTime $updatedDate null;
  20.     #[ORM\Column(name'client_updated_date'type'datetime'nullabletrue)]
  21.     private ?\DateTime $clientUpdateDate null;
  22.     #[ORM\Column(name'name'type'string'length255)]
  23.     private ?string $name;
  24.     #[ORM\Column(name'type'type'string'length255)]
  25.     private string $type;
  26.     #[ORM\Column(name'agree_rgpd'type'boolean'nullabletrue)]
  27.     private bool $agreeRgpd false;
  28.     #[ORM\Column(name'description'type'text'nullabletrue)]
  29.     private ?string $description;
  30.     #[ORM\Column(name'address_number'type'integer'nullabletrue)]
  31.     private ?int $addressNumber;
  32.     #[ORM\Column(name'address_locality'type'string'nullabletrue)]
  33.     private ?string $addressLocality;
  34.     #[ORM\Column(name'address_road'type'string'nullabletrue)]
  35.     private ?string $addressRoad;
  36.     #[ORM\Column(name'phone_standard'type'string')]
  37.     private ?string $phoneStandard null;
  38.     #[ORM\Column(name'phone_other'type'string'nullabletrue)]
  39.     private ?string $phoneOther;
  40.     #[ORM\Column(name'email'type'string')]
  41.     private ?string $email;
  42.     #[ORM\Column(name'latitude'type'string'nullabletrue)]
  43.     private ?string $latitude;
  44.     #[ORM\Column(name'longitude'type'string'nullabletrue)]
  45.     private ?string $longitude;
  46.     #[ORM\Column(name'maps_address'type'string'nullabletrue)]
  47.     private ?string $mapsAddress;
  48.     #[ORM\Column(name'other_activity1'type'string'nullabletrue)]
  49.     private ?string $otherActivity1;
  50.     #[ORM\Column(name'other_activity2'type'string'nullabletrue)]
  51.     private ?string $otherActivity2;
  52.     #[ORM\Column(name'other_activity3'type'string'nullabletrue)]
  53.     private ?string $otherActivity3;
  54.     #[ORM\Column(name'other_activity4'type'string'nullabletrue)]
  55.     private ?string $otherActivity4;
  56.     #[ORM\Column(name'other_activity5'type'string'nullabletrue)]
  57.     private ?string $otherActivity5;
  58.     #[ORM\Column(name'other_activity6'type'string'nullabletrue)]
  59.     private ?string $otherActivity6;
  60.     #[ORM\OneToMany(mappedBy'school'targetEntityPersonDegree::class)]
  61.     private Collection $personDegrees;
  62.     #[ORM\Column(name'registration'type'string'length255uniquetruenullabletrue)]
  63.     #[IFEFAssert\DuplicateSchoolRegistered]
  64.     private ?string $registration;
  65.     #[ORM\Column(name'other_degree'type'string'nullabletrue)]
  66.     private ?string $otherDegree;
  67.     #[ORM\ManyToOne(targetEntityCity::class)]
  68.     #[ORM\JoinColumn(name'id_city'referencedColumnName'id')]
  69.     private ?City $city null;
  70.     #[ORM\ManyToOne(targetEntityRegion::class, inversedBy'schools')]
  71.     #[ORM\JoinColumn(name'id_region'referencedColumnName'id')]
  72.     private ?Region $region null;
  73.     #[ORM\ManyToOne(targetEntityCountry::class)]
  74.     #[ORM\JoinColumn(name'id_country'referencedColumnName'id')]
  75.     private ?Country $country null;
  76.     #[ORM\ManyToOne(targetEntityImage::class, cascade: ['persist''remove'])]
  77.     #[ORM\JoinColumn(name'id_image'referencedColumnName'id')]
  78.     private Image $image;
  79.     #[ORM\ManyToMany(targetEntityCompany::class)]
  80.     #[ORM\JoinTable(name'schools_companies')]
  81.     #[ORM\JoinColumn(name'school_id'referencedColumnName'id')]
  82.     #[ORM\InverseJoinColumn(name'company_id'referencedColumnName'id')]
  83.     private Collection $companies;
  84.     #[ORM\ManyToMany(targetEntitySocialNetwork::class, cascade: ['persist''remove'])]
  85.     #[ORM\JoinTable(name'schools_socials')]
  86.     #[ORM\JoinColumn(name'school_id'referencedColumnName'id')]
  87.     #[ORM\InverseJoinColumn(name'social_id'referencedColumnName'id')]
  88.     private Collection $socialNetworks;
  89.     #[ORM\OneToOne(targetEntityUser::class)]
  90.     #[ORM\JoinColumn(name'user_id'referencedColumnName'id'nullabletrue)]
  91.     private User $user;
  92.     #[ORM\ManyToMany(targetEntityDegree::class)]
  93.     #[ORM\JoinTable(name'school_degrees1')]
  94.     #[ORM\JoinColumn(name'school_id'referencedColumnName'id')]
  95.     #[ORM\InverseJoinColumn(name'degree_id'referencedColumnName'id')]
  96.     private Collection $degrees;
  97.     #[ORM\ManyToOne(targetEntitySectorArea::class)]
  98.     #[ORM\JoinColumn(name'id_sector_area1'referencedColumnName'id')]
  99.     private ?SectorArea $sectorArea1 null;
  100.     #[ORM\ManyToOne(targetEntitySectorArea::class)]
  101.     #[ORM\JoinColumn(name'id_sector_area2'referencedColumnName'id'nullabletrue)]
  102.     private ?SectorArea $sectorArea2 null;
  103.     #[ORM\ManyToOne(targetEntitySectorArea::class)]
  104.     #[ORM\JoinColumn(name'id_sector_area3'referencedColumnName'id'nullabletrue)]
  105.     private ?SectorArea $sectorArea3 null;
  106.     #[ORM\ManyToOne(targetEntitySectorArea::class)]
  107.     #[ORM\JoinColumn(name'id_sector_area4'referencedColumnName'id'nullabletrue)]
  108.     private ?SectorArea $sectorArea4 null;
  109.     #[ORM\ManyToOne(targetEntitySectorArea::class)]
  110.     #[ORM\JoinColumn(name'id_sector_area5'referencedColumnName'id'nullabletrue)]
  111.     private ?SectorArea $sectorArea5 null;
  112.     #[ORM\ManyToOne(targetEntitySectorArea::class)]
  113.     #[ORM\JoinColumn(name'id_sector_area6'referencedColumnName'id'nullabletrue)]
  114.     private ?SectorArea $sectorArea6 null;
  115.     #[ORM\ManyToMany(targetEntityActivity::class)]
  116.     #[ORM\JoinTable(name'school_activities1')]
  117.     #[ORM\JoinColumn(name'school_id'referencedColumnName'id')]
  118.     #[ORM\InverseJoinColumn(name'activity_id'referencedColumnName'id')]
  119.     private Collection $activities1;
  120.     #[ORM\ManyToMany(targetEntityActivity::class)]
  121.     #[ORM\JoinTable(name'school_activities2')]
  122.     #[ORM\JoinColumn(name'school_id'referencedColumnName'id')]
  123.     #[ORM\InverseJoinColumn(name'activity_id'referencedColumnName'id')]
  124.     private Collection $activities2;
  125.     #[ORM\ManyToMany(targetEntityActivity::class)]
  126.     #[ORM\JoinTable(name'school_activities3')]
  127.     #[ORM\JoinColumn(name'school_id'referencedColumnName'id')]
  128.     #[ORM\InverseJoinColumn(name'activity_id'referencedColumnName'id')]
  129.     private Collection $activities3;
  130.     #[ORM\ManyToMany(targetEntityActivity::class)]
  131.     #[ORM\JoinTable(name'school_activities4')]
  132.     #[ORM\JoinColumn(name'school_id'referencedColumnName'id')]
  133.     #[ORM\InverseJoinColumn(name'activity_id'referencedColumnName'id')]
  134.     private Collection $activities4;
  135.     #[ORM\ManyToMany(targetEntityActivity::class)]
  136.     #[ORM\JoinTable(name'school_activities5')]
  137.     #[ORM\JoinColumn(name'school_id'referencedColumnName'id')]
  138.     #[ORM\InverseJoinColumn(name'activity_id'referencedColumnName'id')]
  139.     private Collection $activities5;
  140.     #[ORM\ManyToMany(targetEntityActivity::class)]
  141.     #[ORM\JoinTable(name'school_activities6')]
  142.     #[ORM\JoinColumn(name'school_id'referencedColumnName'id')]
  143.     #[ORM\InverseJoinColumn(name'activity_id'referencedColumnName'id')]
  144.     private Collection $activities6;
  145.     #[ORM\Column(name'location_mode'type'boolean'nullabletrue)]
  146.     private ?bool $locationMode;
  147.     #[ORM\OneToMany(mappedBy'school'targetEntityJobOffer::class, cascade: ['persist''remove'])]
  148.     private Collection $jobOffers;
  149.     public function __construct() {
  150.         $this->socialNetworks = new ArrayCollection();
  151.         $this->activities1 = new ArrayCollection();
  152.         $this->activities2 = new ArrayCollection();
  153.         $this->activities3 = new ArrayCollection();
  154.         $this->activities4 = new ArrayCollection();
  155.         $this->activities5 = new ArrayCollection();
  156.         $this->activities6 = new ArrayCollection();
  157.         $this->degrees = new ArrayCollection();
  158.         $this->personDegrees = new ArrayCollection();
  159.         $this->companies = new ArrayCollection();
  160.         $this->jobOffers = new ArrayCollection();
  161.     }
  162.     public function getId(): ?int {
  163.         return $this->id;
  164.     }
  165.     public function getCreatedDate(): ?\DateTime {
  166.         return $this->createdDate;
  167.     }
  168.     public function setCreatedDate(?\DateTime $createdDate): self {
  169.         $this->createdDate $createdDate;
  170.         return $this;
  171.     }
  172.     public function getUpdatedDate(): ?\DateTime {
  173.         return $this->updatedDate;
  174.     }
  175.     public function setUpdatedDate(?\DateTime $updatedDate): self {
  176.         $this->updatedDate $updatedDate;
  177.         return $this;
  178.     }
  179.     public function getClientUpdateDate(): ?\DateTime {
  180.         return $this->clientUpdateDate;
  181.     }
  182.     public function setClientUpdateDate(?\DateTime $clientUpdateDate): self {
  183.         $this->clientUpdateDate $clientUpdateDate;
  184.         return $this;
  185.     }
  186.     public function getName(): ?string {
  187.         return $this->name;
  188.     }
  189.     public function setName(?string $name): self {
  190.         $this->name $name;
  191.         return $this;
  192.     }
  193.     public function getType(): string {
  194.         return $this->type;
  195.     }
  196.     public function setType(string $type): self {
  197.         $this->type $type;
  198.         return $this;
  199.     }
  200.     public function isAgreeRgpd(): bool {
  201.         return $this->agreeRgpd;
  202.     }
  203.     public function setAgreeRgpd(bool $agreeRgpd): self {
  204.         $this->agreeRgpd $agreeRgpd;
  205.         return $this;
  206.     }
  207.     public function getDescription(): ?string {
  208.         return $this->description;
  209.     }
  210.     public function setDescription(?string $description): void {
  211.         $this->description $description;
  212.     }
  213.     public function getCity(): ?City {
  214.         return $this->city;
  215.     }
  216.     public function setCity(?City $city null): self {
  217.         $this->city $city;
  218.         return $this;
  219.     }
  220.     public function getRegion(): ?Region {
  221.         return $this->region;
  222.     }
  223.     public function setRegion(?Region $region): self {
  224.         $this->region $region;
  225.         return $this;
  226.     }
  227.     public function getCountry(): ?Country {
  228.         return $this->country;
  229.     }
  230.     public function setCountry(?Country $country): self {
  231.         $this->country $country;
  232.         return $this;
  233.     }
  234.     public function getAddressNumber(): ?int {
  235.         return $this->addressNumber;
  236.     }
  237.     public function setAddressNumber(?int $addressNumber): void {
  238.         $this->addressNumber $addressNumber;
  239.     }
  240.     public function getAddressLocality(): ?string {
  241.         return $this->addressLocality;
  242.     }
  243.     public function setAddressLocality(?string $addressLocality): void {
  244.         $this->addressLocality $addressLocality;
  245.     }
  246.     public function getAddressRoad(): ?string {
  247.         return $this->addressRoad;
  248.     }
  249.     public function setAddressRoad(?string $addressRoad): void {
  250.         $this->addressRoad $addressRoad;
  251.     }
  252.     public function getPhoneStandard(): ?string {
  253.         return $this->phoneStandard;
  254.     }
  255.     public function setPhoneStandard(?string $phoneStandard): void {
  256.         $this->phoneStandard $phoneStandard;
  257.     }
  258.     public function getPhoneOther(): ?string {
  259.         return $this->phoneOther;
  260.     }
  261.     public function setPhoneOther(?string $phoneOther): self {
  262.         $this->phoneOther $phoneOther;
  263.         return $this;
  264.     }
  265.     public function getEmail(): ?string {
  266.         return $this->email;
  267.     }
  268.     public function setEmail(?string $email): void {
  269.         $this->email $email;
  270.     }
  271.     public function getImage(): Image {
  272.         return $this->image;
  273.     }
  274.     public function setImage(Image $image): void {
  275.         $this->image $image;
  276.     }
  277.     public function getRegistration(): ?string {
  278.         return $this->registration;
  279.     }
  280.     public function setRegistration(?string $registration): self {
  281.         $this->registration $registration;
  282.         return $this;
  283.     }
  284.     public function addSocialNetwork(SocialNetwork $socialNetwork): self {
  285.         $this->socialNetworks->add($socialNetwork);
  286.         return $this;
  287.     }
  288.     public function removeSocialNetwork(SocialNetwork $socialNetwork): bool {
  289.         return $this->socialNetworks->removeElement($socialNetwork);
  290.     }
  291.     public function getSocialNetworks(): Collection {
  292.         return $this->socialNetworks;
  293.     }
  294.     public function getLatitude(): ?string {
  295.         return $this->latitude;
  296.     }
  297.     public function setLatitude(?string $latitude): self {
  298.         $this->latitude $latitude;
  299.         return $this;
  300.     }
  301.     public function getLongitude(): ?string {
  302.         return $this->longitude;
  303.     }
  304.     public function setLongitude(?string $longitude): self {
  305.         $this->longitude $longitude;
  306.         return $this;
  307.     }
  308.     public function getMapsAddress(): ?string {
  309.         return $this->mapsAddress;
  310.     }
  311.     public function setMapsAddress(?string $mapsAddress): self {
  312.         $this->mapsAddress $mapsAddress;
  313.         return $this;
  314.     }
  315.     public function __toString() {
  316.         return $this->name ', ' $this->city->getName();
  317.     }
  318.     public function setUser(User $user null): self {
  319.         $this->user $user;
  320.         return $this;
  321.     }
  322.     public function getUser(): User {
  323.         return $this->user;
  324.     }
  325.     public function getSectorArea1(): ?SectorArea {
  326.         return $this->sectorArea1;
  327.     }
  328.     public function setSectorArea1(?SectorArea $sectorArea1): self {
  329.         $this->sectorArea1 $sectorArea1;
  330.         return $this;
  331.     }
  332.     public function getSectorArea2(): ?SectorArea {
  333.         return $this->sectorArea2;
  334.     }
  335.     public function setSectorArea2(?SectorArea $sectorArea2): self {
  336.         $this->sectorArea2 $sectorArea2;
  337.         return $this;
  338.     }
  339.     public function getSectorArea3(): ?SectorArea {
  340.         return $this->sectorArea3;
  341.     }
  342.     public function setSectorArea3(?SectorArea $sectorArea3): self {
  343.         $this->sectorArea3 $sectorArea3;
  344.         return $this;
  345.     }
  346.     public function getSectorArea4(): ?SectorArea {
  347.         return $this->sectorArea4;
  348.     }
  349.     public function setSectorArea4(?SectorArea $sectorArea4): self {
  350.         $this->sectorArea4 $sectorArea4;
  351.         return $this;
  352.     }
  353.     public function getSectorArea5(): ?SectorArea {
  354.         return $this->sectorArea5;
  355.     }
  356.     public function setSectorArea5(?SectorArea $sectorArea5): self {
  357.         $this->sectorArea5 $sectorArea5;
  358.         return $this;
  359.     }
  360.     public function getSectorArea6(): ?SectorArea {
  361.         return $this->sectorArea6;
  362.     }
  363.     public function setSectorArea6(?SectorArea $sectorArea6): self {
  364.         $this->sectorArea6 $sectorArea6;
  365.         return $this;
  366.     }
  367.     public function addActivities1(Activity $activities1): self {
  368.         $this->activities1->add($activities1);
  369.         return $this;
  370.     }
  371.     public function removeActivities1(Activity $activities1): void {
  372.         $this->activities1->removeElement($activities1);
  373.     }
  374.     public function getActivities1(): Collection {
  375.         return $this->activities1;
  376.     }
  377.     public function addActivities2(Activity $activities2): self {
  378.         $this->activities2->add($activities2);
  379.         return $this;
  380.     }
  381.     public function removeActivities2(Activity $activities2): void {
  382.         $this->activities2->removeElement($activities2);
  383.     }
  384.     public function getActivities2(): Collection {
  385.         return $this->activities2;
  386.     }
  387.     public function addActivities3(Activity $activities3): self {
  388.         $this->activities3->add($activities3);
  389.         return $this;
  390.     }
  391.     public function removeActivities3(Activity $activities3): void {
  392.         $this->activities3->removeElement($activities3);
  393.     }
  394.     public function getActivities3(): Collection {
  395.         return $this->activities3;
  396.     }
  397.     public function addActivities4(Activity $activities4): self {
  398.         $this->activities4->add($activities4);
  399.         return $this;
  400.     }
  401.     public function removeActivities4(Activity $activities4): void {
  402.         $this->activities4->removeElement($activities4);
  403.     }
  404.     public function getActivities4(): Collection {
  405.         return $this->activities4;
  406.     }
  407.     public function addDegree(Degree $degree): self {
  408.         $this->degrees->add($degree);
  409.         return $this;
  410.     }
  411.     public function removeDegree(Degree $degree): void {
  412.         $this->degrees->removeElement($degree);
  413.     }
  414.     public function getDegrees(): Collection {
  415.         return $this->degrees;
  416.     }
  417.     public function getOtherDegree(): ?string {
  418.         return $this->otherDegree;
  419.     }
  420.     public function setOtherDegree(?string $otherDegree): self {
  421.         $this->otherDegree $otherDegree;
  422.         return $this;
  423.     }
  424.     public function setOtherActivity1(?string $otherActivity1): self {
  425.         $this->otherActivity1 $otherActivity1;
  426.         return $this;
  427.     }
  428.     public function getOtherActivity1(): ?string {
  429.         return $this->otherActivity1;
  430.     }
  431.     public function setOtherActivity2(?string $otherActivity2): self {
  432.         $this->otherActivity2 $otherActivity2;
  433.         return $this;
  434.     }
  435.     public function getOtherActivity2(): ?string {
  436.         return $this->otherActivity2;
  437.     }
  438.     public function setOtherActivity3(?string $otherActivity3): self {
  439.         $this->otherActivity3 $otherActivity3;
  440.         return $this;
  441.     }
  442.     public function getOtherActivity3(): ?string {
  443.         return $this->otherActivity3;
  444.     }
  445.     public function setOtherActivity4(?string $otherActivity4): self {
  446.         $this->otherActivity4 $otherActivity4;
  447.         return $this;
  448.     }
  449.     public function getOtherActivity4(): ?string {
  450.         return $this->otherActivity4;
  451.     }
  452.     public function getOtherActivity5(): ?string {
  453.         return $this->otherActivity5;
  454.     }
  455.     public function setOtherActivity5(?string $otherActivity5): self {
  456.         $this->otherActivity5 $otherActivity5;
  457.         return $this;
  458.     }
  459.     public function getOtherActivity6(): ?string {
  460.         return $this->otherActivity6;
  461.     }
  462.     public function setOtherActivity6(?string $otherActivity6): self {
  463.         $this->otherActivity6 $otherActivity6;
  464.         return $this;
  465.     }
  466.     public function getAgreeRgpd(): bool {
  467.         return $this->agreeRgpd;
  468.     }
  469.     public function addPersonDegree(PersonDegree $personDegree) {
  470.         $this->personDegrees->add($personDegree);
  471.         return $this;
  472.     }
  473.     public function removePersonDegree(PersonDegree $personDegree): void {
  474.         $this->personDegrees->removeElement($personDegree);
  475.     }
  476.     public function getPersonDegrees(): Collection {
  477.         return $this->personDegrees;
  478.     }
  479.     public function addCompany(Company $company): self {
  480.         $this->companies->add($company);
  481.         return $this;
  482.     }
  483.     public function removeCompany(Company $company): void {
  484.         $this->companies->removeElement($company);
  485.     }
  486.     public function getCompanies(): Collection {
  487.         return $this->companies;
  488.     }
  489.     public function addActivities5(Activity $activities5): self {
  490.         $this->activities5->add($activities5);
  491.         return $this;
  492.     }
  493.     public function removeActivities5(Activity $activities5): bool {
  494.         return $this->activities5->removeElement($activities5);
  495.     }
  496.     public function getActivities5(): Collection {
  497.         return $this->activities5;
  498.     }
  499.     public function addActivities6(Activity $activities6): self {
  500.         $this->activities6->add($activities6);
  501.         return $this;
  502.     }
  503.     public function removeActivities6(Activity $activities6): bool {
  504.         return $this->activities6->removeElement($activities6);
  505.     }
  506.     public function getActivities6(): Collection {
  507.         return $this->activities6;
  508.     }
  509.     public function isLocationMode(): ?bool {
  510.         return $this->locationMode;
  511.     }
  512.     public function setLocationMode(?bool $locationMode): void {
  513.         $this->locationMode $locationMode;
  514.     }
  515.     #[ORM\PrePersist]
  516.     public function prePersist(): void {
  517.         if ($this->jobOffers->count()) {
  518.             /** @var JobOffer $job */
  519.             foreach ($this->jobOffers as $job) {
  520.                 $job->setSchool($this);
  521.             }
  522.         }
  523.     }
  524.     public function removeJob(JobOffer $job): void {
  525.         $this->jobOffers->removeElement($job);
  526.     }
  527.     public function addJobOffer(JobOffer $jobOffer): self {
  528.         $this->jobOffers->add($jobOffer);
  529.         return $this;
  530.     }
  531.     public function removeJobOffer(JobOffer $jobOffer): void {
  532.         $this->jobOffers->removeElement($jobOffer);
  533.     }
  534.     public function getJobOffers(): Collection {
  535.         return $this->jobOffers;
  536.     }
  537.     /**
  538.      * @return Prefecture|null
  539.      */
  540.     public function getPrefecture(): ?Prefecture {
  541.         return $this->city?->getPrefecture();
  542.     }
  543.     /**
  544.      * @param Prefecture|null $prefecture
  545.      * @return School
  546.      */
  547.     public function setPrefecture(?Prefecture $prefecture): School
  548.     {
  549.         return $this;
  550.     }
  551.     public function schoolPresentation(): string {
  552.         if ($this->city) {
  553.             return sprintf('%s (%s)'$this->getName(), $this->city->getName());
  554.         }
  555.         return $this->getName();
  556.     }
  557. }