src/Entity/Adherent/MagasinCollaborateurs.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Adherent;
  3. use App\Entity\Image\Image;
  4. use App\Repository\Adherent\MagasinCollaborateursRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use JetBrains\PhpStorm\NoReturn;
  9. use Symfony\Component\Validator\Constraints\DateTime;
  10. use Symfony\Component\Validator\Context\ExecutionContextInterface;
  11. use Symfony\Component\Validator\Constraints as Assert;
  12. #[ORM\Entity(repositoryClassMagasinCollaborateursRepository::class)]
  13. class MagasinCollaborateurs implements \Stringable
  14. {
  15.     #[ORM\Id]
  16.     #[ORM\GeneratedValue]
  17.     #[ORM\Column(type'integer')]
  18.     private $id;
  19.     #[ORM\Column(type'string'name'firstname'nullabletrue)]
  20.     private ?string $firstname null;
  21.     #[ORM\Column(type'string'name'lastname'nullabletrue)]
  22.     private ?string $lastname null;
  23.     #[ORM\Column(type'string'name'jobs'nullabletrue)]
  24.     private ?string $jobs null;
  25.     #[ORM\Column(type'string'name'jobs_nl'nullabletrue)]
  26.     private ?string $jobsNl null;
  27.     #[ORM\Column(type'array'nullabletrue)]
  28.     private $specialties = [];
  29.     #[ORM\Column(type'array'nullabletrue)]
  30.     private $specialtiesNl null;
  31.     #[ORM\Column(type'string'name'verbatim'nullabletrue)]
  32.     private ?string $verbatim null;
  33.     #[ORM\Column(type'string'name'verbatim_nl'nullabletrue)]
  34.     private ?string $verbatimNl null;
  35.     #[ORM\Column(type'text'name'presentation'nullabletrue)]
  36.     private ?string $presentation null;
  37.     #[ORM\Column(type'text'name'presentation_nl'nullabletrue)]
  38.     private ?string $presentationNl null;
  39.     #[ORM\Column(type'datetime'name'created_at')]
  40.     private \datetime $createdAt;
  41.     #[ORM\ManyToOne(targetEntity\App\Entity\Adherent\Magasin::class, inversedBy'magasinCollaborateurs')]
  42.     #[ORM\JoinColumn(name'magasin'referencedColumnName'k_adherent')]
  43.     private $magasin;
  44.     #[ORM\OneToMany(targetEntityMagasinCollaborateurDiplomes::class, mappedBy'magasinCollaborateurs')]
  45.     private $magasinCollaborateurDiplomes;
  46.     #[ORM\Column(type'boolean'name'sort')]
  47.     private $sort;
  48.     #[ORM\OneToMany(targetEntity\App\Entity\Webfactory\Page\Classique\Store::class, mappedBy'equipeVerbatim')]
  49.     private $pagesMagasinClassique;
  50.     #[ORM\Column(type'text'name'image'nullabletrue)]
  51.     private ?string $image null;
  52.     public function __construct()
  53.     {
  54.         $this->createdAt = new \DateTime('now');
  55.         $this->magasinCollaborateurDiplomes = new ArrayCollection();
  56.         $this->pagesMagasinClassique = new ArrayCollection();
  57.     }
  58.     #[Assert\Callback]
  59.      public function validate(ExecutionContextInterface $context): void {
  60.         $authorisedExtensions = ["png""jpeg""jpg"];
  61.         if (!is_null($this->image)){
  62.             $extension pathinfo($this->imagePATHINFO_EXTENSION);
  63.             if (in_array($extension$authorisedExtensionstrue)) {
  64.                 $this->setImage($this->image);
  65.             } else {
  66.                 $context->buildViolation("Le format d'image doit etre de type Jpg, jpeg, png")
  67.                     ->atPath('image')->addViolation();
  68.             }
  69.         }
  70.     }
  71.     public function getId(): ?int
  72.     {
  73.         return $this->id;
  74.     }
  75.     public function setId(int $id)
  76.     {
  77.         $this->id $id;
  78.     }
  79.     /**
  80.      * @return string
  81.      */
  82.     public function getFirstname(): ?string
  83.     {
  84.         return $this->firstname;
  85.     }
  86.     public function setFirstname(?string $firstname): void
  87.     {
  88.         $this->firstname $firstname;
  89.     }
  90.     /**
  91.      * @return string
  92.      */
  93.     public function getLastname(): ?string
  94.     {
  95.         return $this->lastname;
  96.     }
  97.     public function setLastname(?string $lastname): void
  98.     {
  99.         $this->lastname $lastname;
  100.     }
  101.     /**
  102.      * @return string
  103.      */
  104.     public function getJobs(): ?string
  105.     {
  106.         return $this->jobs;
  107.     }
  108.     public function setJobs(?string $jobs): void
  109.     {
  110.         $this->jobs $jobs;
  111.     }
  112.     /**
  113.      * @return array|string|null
  114.      */
  115.     public function getSpecialties(): array|string|null
  116.     {
  117.         return $this->specialties;
  118.     }
  119.     /**
  120.      * @param array|string|null $specialties
  121.      */
  122.     public function setSpecialties(array|string|null $specialties): void
  123.     {
  124.         $this->specialties $specialties;
  125.     }
  126.     /**
  127.      * @return string
  128.      */
  129.     public function getVerbatim()
  130.     {
  131.         return $this->verbatim;
  132.     }
  133.     /**
  134.      * @param string $verbatim
  135.      */
  136.     public function setVerbatim($verbatim)
  137.     {
  138.         $this->verbatim $verbatim;
  139.     }
  140.     /**
  141.      * @return string
  142.      */
  143.     public function getPresentation()
  144.     {
  145.         return $this->presentation;
  146.     }
  147.     /**
  148.      * @param string $presentation
  149.      */
  150.     public function setPresentation($presentation)
  151.     {
  152.         $this->presentation $presentation;
  153.     }
  154.     public function getCreatedAt(): DateTime
  155.     {
  156.         return $this->createdAt;
  157.     }
  158.     public function setCreatedAt(DateTime $createdAt): void
  159.     {
  160.         $this->createdAt $createdAt;
  161.     }
  162.     /**
  163.      * @return mixed
  164.      */
  165.     public function getMagasin()
  166.     {
  167.         return $this->magasin;
  168.     }
  169.     public function setMagasin(mixed $magasin): void
  170.     {
  171.         $this->magasin $magasin;
  172.     }
  173.     /**
  174.      * @return Collection|MagasinCollaborateurDiplomes[]
  175.      */
  176.     public function getMagasinCollaborateurDiplomes(): Collection
  177.     {
  178.         return $this->magasinCollaborateurDiplomes;
  179.     }
  180.     public function addMagasinCollaborateurDiplome(MagasinCollaborateurDiplomes $magasinCollaborateurDiplome): self
  181.     {
  182.         if (!$this->magasinCollaborateurDiplomes->contains($magasinCollaborateurDiplome)) {
  183.             $this->magasinCollaborateurDiplomes[] = $magasinCollaborateurDiplome;
  184.             $magasinCollaborateurDiplome->setMagasinCollaborateurs($this);
  185.         }
  186.         return $this;
  187.     }
  188.     public function removeMagasinCollaborateurDiplome(MagasinCollaborateurDiplomes $magasinCollaborateurDiplome): self
  189.     {
  190.         if ($this->magasinCollaborateurDiplomes->removeElement($magasinCollaborateurDiplome)) {
  191.             // set the owning side to null (unless already changed)
  192.             if ($magasinCollaborateurDiplome->getMagasinCollaborateurs() === $this) {
  193.                 $magasinCollaborateurDiplome->setMagasinCollaborateurs(null);
  194.             }
  195.         }
  196.         return $this;
  197.     }
  198.     /**
  199.      * @return mixed
  200.      */
  201.     public function getSort()
  202.     {
  203.         return $this->sort;
  204.     }
  205.     public function setSort(mixed $sort): void
  206.     {
  207.         $this->sort $sort;
  208.     }
  209.     public function __toString(): string{
  210.         return $this->firstname" ".$this->lastname;
  211.     }
  212.     /**
  213.      * @return Collection|\App\Entity\Webfactory\Page\classique\Store[]
  214.      */
  215.     public function getMagasins(): Collection
  216.     {
  217.         return $this->pagesMagasinClassique;
  218.     }
  219.     public function addMagasin(\App\Entity\Webfactory\Page\classique\Store $pageMagasinClassique): self
  220.     {
  221.         if (!$this->pagesMagasinClassique->contains($pageMagasinClassique)) {
  222.             $this->pagesMagasinClassique[] = $pageMagasinClassique;
  223.             $pageMagasinClassique->setEquipeVerbatim($this);
  224.         }
  225.         return $this;
  226.     }
  227.     public function removeMagasin(\App\Entity\Webfactory\Page\classique\Store $pageMagasinClassique): self
  228.     {
  229.         if ($this->pagesMagasinClassique->removeElement($pageMagasinClassique)) {
  230.             // set the owning side to null (unless already changed)
  231.             if ($pageMagasinClassique->getEquipeVerbatim() === $this) {
  232.                 $pageMagasinClassique->setEquipeVerbatim(null);
  233.             }
  234.         }
  235.         return $this;
  236.     }
  237.     /**
  238.      * @return string
  239.      */
  240.     public function getImage()
  241.     {
  242.         return $this->image;
  243.     }
  244.     /**
  245.      * @param string $image
  246.      */
  247.     public function setImage($image): void
  248.     {
  249.         $this->image $image;
  250.     }
  251.     /**
  252.      * @return string
  253.      */
  254.     public function getJobsNl(): ?string
  255.     {
  256.         return $this->jobsNl;
  257.     }
  258.     /**
  259.      * @param string $jobsNl
  260.      */
  261.     public function setJobsNl($jobsNl): void
  262.     {
  263.         $this->jobsNl $jobsNl;
  264.     }
  265.     /**
  266.      * @return string
  267.      */
  268.     public function getSpecialtiesNl()
  269.     {
  270.         return $this->specialtiesNl;
  271.     }
  272.     /**
  273.      * @param string $specialtiesNl
  274.      */
  275.     public function setSpecialtiesNl($specialtiesNl): void
  276.     {
  277.         $this->specialtiesNl $specialtiesNl;
  278.     }
  279.     /**
  280.      * @return string
  281.      */
  282.     public function getVerbatimNl()
  283.     {
  284.         return $this->verbatimNl;
  285.     }
  286.     /**
  287.      * @param string $verbatimNl
  288.      */
  289.     public function setVerbatimNl($verbatimNl)
  290.     {
  291.         $this->verbatimNl $verbatimNl;
  292.     }
  293.     /**
  294.      * @return string
  295.      */
  296.     public function getPresentationNl()
  297.     {
  298.         return $this->presentationNl;
  299.     }
  300.     /**
  301.      * @param string $presentationNl
  302.      */
  303.     public function setPresentationNl($presentationNl)
  304.     {
  305.         $this->presentationNl $presentationNl;
  306.     }
  307.     public function getPagesMagasinClassique(): ArrayCollection
  308.     {
  309.         return $this->pagesMagasinClassique;
  310.     }
  311.     public function setPagesMagasinClassique(ArrayCollection $pagesMagasinClassique): void
  312.     {
  313.         $this->pagesMagasinClassique $pagesMagasinClassique;
  314.     }
  315. }