src/Entity/Company.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\CompanyRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassCompanyRepository::class)]
  8. #[ORM\HasLifecycleCallbacks]
  9. class Company {
  10.     #[ORM\Id]
  11.     #[ORM\Column(name'id'type'integer')]
  12.     #[ORM\GeneratedValue(strategy'AUTO')]
  13.     private ?int $id null;
  14.     #[ORM\Column(name'name'type'string'length255)]
  15.     private ?string $name;
  16.     #[ORM\Column(name'url'type'string'length255nullabletrue)]
  17.     private ?string $url;
  18.     #[ORM\Column(name'created_date'type'datetime')]
  19.     private ?\DateTime $createdDate null;
  20.     #[ORM\Column(name'updated_date'type'datetime'nullabletrue)]
  21.     private ?\DateTime $updatedDate null;
  22.     #[ORM\Column(name'client_updated_date'type'datetime'nullabletrue)]
  23.     private ?\DateTime $clientUpdateDate null;
  24.     #[ORM\ManyToOne(targetEntityCity::class)]
  25.     #[ORM\JoinColumn(name'id_city'referencedColumnName'id')]
  26.     private ?City $city null;
  27.     #[ORM\Column(name'other_city'type'string'nullabletrue)]
  28.     private ?string $otherCity;
  29.     #[ORM\ManyToOne(targetEntityRegion::class)]
  30.     #[ORM\JoinColumn(name'id_region'referencedColumnName'id')]
  31.     private ?Region $region;
  32.     #[ORM\ManyToOne(targetEntityCountry::class)]
  33.     #[ORM\JoinColumn(name'id_country'referencedColumnName'id')]
  34.     private ?Country $country null;
  35.     #[ORM\Column(name'address_number'type'integer'nullabletrue)]
  36.     private ?int $addressNumber;
  37.     #[ORM\Column(name'address_locality'type'string'nullabletrue)]
  38.     private ?string $addressLocality;
  39.     #[ORM\Column(name'address_road'type'string'nullabletrue)]
  40.     private ?string $addressRoad;
  41.     #[ORM\Column(name'phone_standard'type'string')]
  42.     private ?string $phoneStandard null;
  43.     #[ORM\Column(name'phone_other'type'string'nullabletrue)]
  44.     private ?string $phoneOther;
  45.     #[ORM\Column(name'email'type'string')]
  46.     private ?string $email;
  47.     #[ORM\Column(name'temporary_passwd'type'string'nullabletrue)]
  48.     private ?string $temporaryPasswd;
  49.     #[ORM\ManyToOne(targetEntityContactCompany::class)]
  50.     #[ORM\JoinColumn(name'id_contactCompany'referencedColumnName'id')]
  51.     private ?ContactCompany $contactCompany null;
  52.     #[ORM\ManyToOne(targetEntitySectorArea::class)]
  53.     #[ORM\JoinColumn(name'id_sectorArea'referencedColumnName'id')]
  54.     private ?SectorArea $sectorArea null;
  55.     #[ORM\ManyToOne(targetEntityLegalStatus::class)]
  56.     #[ORM\JoinColumn(name'id_legal_status'referencedColumnName'id')]
  57.     private ?LegalStatus $legalStatus null;
  58.     #[ORM\OneToMany(mappedBy'company'targetEntityJobOffer::class, cascade: ['persist''remove'])]
  59.     private Collection $jobOffers;
  60.     #[ORM\OneToMany(mappedBy'company'targetEntityPublicity::class, cascade: ['persist''remove'])]
  61.     private Collection $publicities;
  62.     #[ORM\OneToMany(mappedBy'company'targetEntityPersonDegree::class)]
  63.     private Collection $salaries;
  64.     #[ORM\OneToMany(mappedBy'company'targetEntityApprentice::class, cascade: ['persist''remove'])]
  65.     private Collection $apprentices;
  66.     #[ORM\OneToMany(mappedBy'company'targetEntitySatisfactionCompany::class, cascade: ['persist''remove'])]
  67.     private Collection $satisfactionCompanies;
  68.     #[ORM\ManyToMany(targetEntitySocialNetwork::class, cascade: ['persist''remove'])]
  69.     #[ORM\JoinTable(name'companies_socials')]
  70.     #[ORM\JoinColumn(name'company_id'referencedColumnName'id')]
  71.     #[ORM\InverseJoinColumn(name'social_id'referencedColumnName'id')]
  72.     private Collection $socialNetworks;
  73.     #[ORM\Column(name'latitude'type'string'nullabletrue)]
  74.     private ?string $latitude;
  75.     #[ORM\Column(name'longitude'type'string'nullabletrue)]
  76.     private ?string $longitude;
  77.     #[ORM\Column(name'maps_address'type'string'nullabletrue)]
  78.     private ?string $mapsAddress;
  79.     #[ORM\Column(name'location_fixed'type'boolean')]
  80.     private bool $locationFixed false;
  81.     #[ORM\OneToOne(inversedBy'company'targetEntity'User')]
  82.     #[ORM\JoinColumn(name'user_id'referencedColumnName'id'nullabletrue)]
  83.     private ?User $user null;
  84.     #[ORM\Column(name'agree_rgpd'type'boolean'nullabletrue)]
  85.     private bool $agreeRgpd false;
  86.     #[ORM\ManyToMany(targetEntitySchool::class, mappedBy'companies')]
  87.     private Collection $schools;
  88.     #[ORM\Column(name'location_mode'type'boolean'nullabletrue)]
  89.     private ?bool $locationMode;
  90.     #[ORM\OneToOne(targetEntityImage::class)]
  91.     #[ORM\JoinColumn(name'id_image'referencedColumnName'id'nullabletrue)]
  92.     private ?Image $logo null;
  93.     #[ORM\Column(name'unlocked'type'boolean'nullabletrue)]
  94.     private ?bool $unlocked true;
  95.     public function __construct() {
  96.         $this->jobOffers = new ArrayCollection();
  97.         $this->publicities = new ArrayCollection();
  98.         $this->salaries = new ArrayCollection();
  99.         $this->apprentices = new ArrayCollection();
  100.         $this->satisfactionCompanies = new ArrayCollection();
  101.         $this->schools = new ArrayCollection();
  102.     }
  103.     public function getId(): ?int {
  104.         return $this->id;
  105.     }
  106.     public function getName(): ?string {
  107.         return $this->name;
  108.     }
  109.     public function setName(?string $name): self {
  110.         $this->name $name;
  111.         return $this;
  112.     }
  113.     public function getUrl(): ?string {
  114.         return $this->url;
  115.     }
  116.     public function setUrl(?string $url): self {
  117.         $this->url $url;
  118.         return $this;
  119.     }
  120.     public function getCreatedDate(): ?\DateTime {
  121.         return $this->createdDate;
  122.     }
  123.     public function setCreatedDate(?\DateTime $createdDate): self {
  124.         $this->createdDate $createdDate;
  125.         return $this;
  126.     }
  127.     public function getUpdatedDate(): ?\DateTime {
  128.         return $this->updatedDate;
  129.     }
  130.     public function setUpdatedDate(?\DateTime $updatedDate): self {
  131.         $this->updatedDate $updatedDate;
  132.         return $this;
  133.     }
  134.     public function getClientUpdateDate(): ?\DateTime {
  135.         return $this->clientUpdateDate;
  136.     }
  137.     public function setClientUpdateDate(?\DateTime $clientUpdateDate): self {
  138.         $this->clientUpdateDate $clientUpdateDate;
  139.         return $this;
  140.     }
  141.     public function getCity(): ?City {
  142.         return $this->city;
  143.     }
  144.     public function setCity(City $city null): self {
  145.         $this->city $city;
  146.         return $this;
  147.     }
  148.     public function getOtherCity(): ?string {
  149.         return $this->otherCity;
  150.     }
  151.     public function setOtherCity(?string $otherCity): self {
  152.         $this->otherCity $otherCity;
  153.         return $this;
  154.     }
  155.     public function getAddressNumber(): ?int {
  156.         return $this->addressNumber;
  157.     }
  158.     public function setAddressNumber(?int $addressNumber) {
  159.         $this->addressNumber $addressNumber;
  160.         return $this;
  161.     }
  162.     public function getAddressLocality(): ?string {
  163.         return $this->addressLocality;
  164.     }
  165.     public function setAddressLocality(?string $addressLocality): self {
  166.         $this->addressLocality $addressLocality;
  167.         return $this;
  168.     }
  169.     public function getAddressRoad(): ?string {
  170.         return $this->addressRoad;
  171.     }
  172.     public function setAddressRoad(?string $addressRoad): self {
  173.         $this->addressRoad $addressRoad;
  174.         return $this;
  175.     }
  176.     public function getPhoneStandard(): ?string {
  177.         return $this->phoneStandard;
  178.     }
  179.     public function setPhoneStandard(?string $phoneStandard): void {
  180.         $this->phoneStandard $phoneStandard;
  181.     }
  182.     public function getPhoneOther(): ?string {
  183.         return $this->phoneOther;
  184.     }
  185.     public function setPhoneOther(?string $phoneOther): self {
  186.         $this->phoneOther $phoneOther;
  187.         return $this;
  188.     }
  189.     public function getEmail(): ?string {
  190.         return $this->email;
  191.     }
  192.     public function setEmail(?string $email): void {
  193.         $this->email $email;
  194.     }
  195.     public function getTemporaryPasswd(): ?string {
  196.         return $this->temporaryPasswd;
  197.     }
  198.     public function setTemporaryPasswd(?string $temporaryPasswd): void {
  199.         $this->temporaryPasswd $temporaryPasswd;
  200.     }
  201.     public function getSectorArea(): ?SectorArea {
  202.         return $this->sectorArea;
  203.     }
  204.     public function setSectorArea(?SectorArea $sectorArea null): self {
  205.         $this->sectorArea $sectorArea;
  206.         return $this;
  207.     }
  208.     public function getLegalStatus(): ?LegalStatus {
  209.         return $this->legalStatus;
  210.     }
  211.     public function setLegalStatus(?LegalStatus $legalStatus null): self {
  212.         $this->legalStatus $legalStatus;
  213.         return $this;
  214.     }
  215.     #[ORM\PrePersist]
  216.     public function prePersist(): void {
  217.         if ($this->jobOffers->count()) {
  218.             /** @var JobOffer $job */
  219.             foreach ($this->jobOffers as $job) {
  220.                 $job->setCompany($this);
  221.             }
  222.         }
  223.         if ($this->publicities->count()) {
  224.             /** @var Publicity $publicity */
  225.             foreach ($this->publicities as $publicity) {
  226.                 $publicity->setCompany($this);
  227.             }
  228.         }
  229.     }
  230.     public function addJob(JobOffer $job): self {
  231.         $this->jobOffers[] = $job;
  232.         return $this;
  233.     }
  234.     public function removeJob(JobOffer $job): void {
  235.         $this->jobOffers->removeElement($job);
  236.     }
  237.     public function addJobOffer(JobOffer $jobOffer): self {
  238.         $this->jobOffers->add($jobOffer);
  239.         return $this;
  240.     }
  241.     public function removeJobOffer(JobOffer $jobOffer): void {
  242.         $this->jobOffers->removeElement($jobOffer);
  243.     }
  244.     public function getJobOffers(): Collection {
  245.         return $this->jobOffers;
  246.     }
  247.     public function addPublicity(Publicity $publicity): self {
  248.         $this->publicities->add($publicity);
  249.         return $this;
  250.     }
  251.     public function removePublicity(Publicity $publicity): void {
  252.         $this->publicities->removeElement($publicity);
  253.     }
  254.     public function getPublicities(): Collection {
  255.         return $this->publicities;
  256.     }
  257.     public function getContactCompany(): ?ContactCompany {
  258.         return $this->contactCompany;
  259.     }
  260.     public function setContactCompany(?ContactCompany $contactCompany) {
  261.         $this->contactCompany $contactCompany;
  262.     }
  263.     public function getSalaries(): Collection {
  264.         return $this->salaries;
  265.     }
  266.     public function setSalaries(Collection $salaries): void {
  267.         $this->salaries $salaries;
  268.     }
  269.     public function getApprentices(): Collection {
  270.         return $this->apprentices;
  271.     }
  272.     public function setApprentices(Collection $apprentices): void {
  273.         $this->apprentices $apprentices;
  274.     }
  275.     public function addSalary(PersonDegree $salary): self {
  276.         $this->salaries->add($salary);
  277.         return $this;
  278.     }
  279.     public function removeSalary(PersonDegree $salary): bool {
  280.         return $this->salaries->removeElement($salary);
  281.     }
  282.     public function addApprentice(Apprentice $apprentice): self {
  283.         $this->apprentices->add($apprentice);
  284.         return $this;
  285.     }
  286.     public function removeApprentice(Apprentice $apprentice): bool {
  287.         return $this->apprentices->removeElement($apprentice);
  288.     }
  289.     public function addSatisfactionCompany(SatisfactionCompany $satisfaction): self {
  290.         $this->satisfactionCompanies->add($satisfaction);
  291.         return $this;
  292.     }
  293.     public function removeSatisfactionCompany(SatisfactionCompany $satisfaction): bool {
  294.         return $this->satisfactionCompanies->removeElement($satisfaction);
  295.     }
  296.     public function getSatisfactionCompanies(): Collection {
  297.         return $this->satisfactionCompanies;
  298.     }
  299.     public function addSocialNetwork(SocialNetwork $socialNetwork) {
  300.         $this->socialNetworks->add($socialNetwork);
  301.         return $this;
  302.     }
  303.     public function removeSocialNetwork(SocialNetwork $socialNetwork): bool {
  304.         return $this->socialNetworks->removeElement($socialNetwork);
  305.     }
  306.     public function getSocialNetworks(): Collection {
  307.         return $this->socialNetworks;
  308.     }
  309.     public function getLatitude(): ?string {
  310.         return $this->latitude;
  311.     }
  312.     public function setLatitude(?string $latitude): self {
  313.         $this->latitude $latitude;
  314.         return $this;
  315.     }
  316.     public function getLongitude(): ?string {
  317.         return $this->longitude;
  318.     }
  319.     public function setLongitude(?string $longitude): self {
  320.         $this->longitude $longitude;
  321.         return $this;
  322.     }
  323.     public function getMapsAddress(): ?string {
  324.         return $this->mapsAddress;
  325.     }
  326.     public function setMapsAddress(?string $mapsAddress): self {
  327.         $this->mapsAddress $mapsAddress;
  328.         return $this;
  329.     }
  330.     public function isLocationFixed(): bool {
  331.         return $this->locationFixed;
  332.     }
  333.     public function setLocationFixed(bool $locationFixed): self {
  334.         $this->locationFixed $locationFixed;
  335.         return $this;
  336.     }
  337.     public function __toString(): string {
  338.         return sprintf('%s , %s , %s , %s',
  339.             ucfirst($this->getName()),
  340.             ucfirst($this->getCity()->getRegion()),
  341.             ucfirst($this->getCity()->getName()),
  342.             ucfirst($this->getPhoneStandard())
  343.         );
  344.     }
  345.     public function setRegion(?Region $region null): self {
  346.         $this->region $region;
  347.         return $this;
  348.     }
  349.     public function getRegion(): ?Region {
  350.         return $this->region;
  351.     }
  352.     public function setCountry(Country $country null): self {
  353.         $this->country $country;
  354.         return $this;
  355.     }
  356.     public function getCountry(): ?Country {
  357.         return $this->country;
  358.     }
  359.     public function setUser(?User $user null): self {
  360.         $this->user $user;
  361.         return $this;
  362.     }
  363.     public function getUser(): ?User {
  364.         return $this->user;
  365.     }
  366.     public function isAgreeRgpd(): bool {
  367.         return $this->agreeRgpd;
  368.     }
  369.     public function setAgreeRgpd(bool $agreeRgpd): self {
  370.         $this->agreeRgpd $agreeRgpd;
  371.         return $this;
  372.     }
  373.     public function getLocationFixed(): bool {
  374.         return $this->locationFixed;
  375.     }
  376.     public function getAgreeRgpd(): bool {
  377.         return $this->agreeRgpd;
  378.     }
  379.     public function addSchool(School $school): self {
  380.         $this->schools->add($school);
  381.         return $this;
  382.     }
  383.     public function removeSchool(School $school): void {
  384.         $this->schools->removeElement($school);
  385.     }
  386.     public function getSchools(): Collection {
  387.         return $this->schools;
  388.     }
  389.     public function isLocationMode(): ?bool {
  390.         return $this->locationMode;
  391.     }
  392.     public function setLocationMode(?bool $locationMode): void {
  393.         $this->locationMode $locationMode;
  394.     }
  395.     public function getLogo(): ?Image {
  396.         return $this->logo;
  397.     }
  398.     public function setLogo(?Image $logo): void {
  399.         $this->logo $logo;
  400.     }
  401.     public function isUnlocked(): ?bool {
  402.         return $this->unlocked;
  403.     }
  404.     public function setUnlocked(?bool $unlocked): void {
  405.         $this->unlocked $unlocked;
  406.     }
  407.     /**
  408.      * @return Prefecture|null
  409.      */
  410.     public function getPrefecture(): ?Prefecture {
  411.         return $this->city?->getPrefecture();
  412.     }
  413.     /**
  414.      * @param Prefecture|null $prefecture
  415.      * @return Company
  416.      */
  417.     public function setPrefecture(?Prefecture $prefecture): Company
  418.     {
  419.         return $this;
  420.     }
  421. }