<?php
namespace App\Entity\Adherent;
use App\Entity\Image\Image;
use App\Repository\Adherent\MagasinCollaborateursRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use JetBrains\PhpStorm\NoReturn;
use Symfony\Component\Validator\Constraints\DateTime;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
use Symfony\Component\Validator\Constraints as Assert;
#[ORM\Entity(repositoryClass: MagasinCollaborateursRepository::class)]
class MagasinCollaborateurs implements \Stringable
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\Column(type: 'string', name: 'firstname', nullable: true)]
private ?string $firstname = null;
#[ORM\Column(type: 'string', name: 'lastname', nullable: true)]
private ?string $lastname = null;
#[ORM\Column(type: 'string', name: 'jobs', nullable: true)]
private ?string $jobs = null;
#[ORM\Column(type: 'string', name: 'jobs_nl', nullable: true)]
private ?string $jobsNl = null;
#[ORM\Column(type: 'array', nullable: true)]
private $specialties = [];
#[ORM\Column(type: 'array', nullable: true)]
private $specialtiesNl = null;
#[ORM\Column(type: 'string', name: 'verbatim', nullable: true)]
private ?string $verbatim = null;
#[ORM\Column(type: 'string', name: 'verbatim_nl', nullable: true)]
private ?string $verbatimNl = null;
#[ORM\Column(type: 'text', name: 'presentation', nullable: true)]
private ?string $presentation = null;
#[ORM\Column(type: 'text', name: 'presentation_nl', nullable: true)]
private ?string $presentationNl = null;
#[ORM\Column(type: 'datetime', name: 'created_at')]
private \datetime $createdAt;
#[ORM\ManyToOne(targetEntity: \App\Entity\Adherent\Magasin::class, inversedBy: 'magasinCollaborateurs')]
#[ORM\JoinColumn(name: 'magasin', referencedColumnName: 'k_adherent')]
private $magasin;
#[ORM\OneToMany(targetEntity: MagasinCollaborateurDiplomes::class, mappedBy: 'magasinCollaborateurs')]
private $magasinCollaborateurDiplomes;
#[ORM\Column(type: 'boolean', name: 'sort')]
private $sort;
#[ORM\OneToMany(targetEntity: \App\Entity\Webfactory\Page\Classique\Store::class, mappedBy: 'equipeVerbatim')]
private $pagesMagasinClassique;
#[ORM\Column(type: 'text', name: 'image', nullable: true)]
private ?string $image = null;
public function __construct()
{
$this->createdAt = new \DateTime('now');
$this->magasinCollaborateurDiplomes = new ArrayCollection();
$this->pagesMagasinClassique = new ArrayCollection();
}
#[Assert\Callback]
public function validate(ExecutionContextInterface $context): void {
$authorisedExtensions = ["png", "jpeg", "jpg"];
if (!is_null($this->image)){
$extension = pathinfo($this->image, PATHINFO_EXTENSION);
if (in_array($extension, $authorisedExtensions, true)) {
$this->setImage($this->image);
} else {
$context->buildViolation("Le format d'image doit etre de type Jpg, jpeg, png")
->atPath('image')->addViolation();
}
}
}
public function getId(): ?int
{
return $this->id;
}
public function setId(int $id)
{
$this->id = $id;
}
/**
* @return string
*/
public function getFirstname(): ?string
{
return $this->firstname;
}
public function setFirstname(?string $firstname): void
{
$this->firstname = $firstname;
}
/**
* @return string
*/
public function getLastname(): ?string
{
return $this->lastname;
}
public function setLastname(?string $lastname): void
{
$this->lastname = $lastname;
}
/**
* @return string
*/
public function getJobs(): ?string
{
return $this->jobs;
}
public function setJobs(?string $jobs): void
{
$this->jobs = $jobs;
}
/**
* @return array|string|null
*/
public function getSpecialties(): array|string|null
{
return $this->specialties;
}
/**
* @param array|string|null $specialties
*/
public function setSpecialties(array|string|null $specialties): void
{
$this->specialties = $specialties;
}
/**
* @return string
*/
public function getVerbatim()
{
return $this->verbatim;
}
/**
* @param string $verbatim
*/
public function setVerbatim($verbatim)
{
$this->verbatim = $verbatim;
}
/**
* @return string
*/
public function getPresentation()
{
return $this->presentation;
}
/**
* @param string $presentation
*/
public function setPresentation($presentation)
{
$this->presentation = $presentation;
}
public function getCreatedAt(): DateTime
{
return $this->createdAt;
}
public function setCreatedAt(DateTime $createdAt): void
{
$this->createdAt = $createdAt;
}
/**
* @return mixed
*/
public function getMagasin()
{
return $this->magasin;
}
public function setMagasin(mixed $magasin): void
{
$this->magasin = $magasin;
}
/**
* @return Collection|MagasinCollaborateurDiplomes[]
*/
public function getMagasinCollaborateurDiplomes(): Collection
{
return $this->magasinCollaborateurDiplomes;
}
public function addMagasinCollaborateurDiplome(MagasinCollaborateurDiplomes $magasinCollaborateurDiplome): self
{
if (!$this->magasinCollaborateurDiplomes->contains($magasinCollaborateurDiplome)) {
$this->magasinCollaborateurDiplomes[] = $magasinCollaborateurDiplome;
$magasinCollaborateurDiplome->setMagasinCollaborateurs($this);
}
return $this;
}
public function removeMagasinCollaborateurDiplome(MagasinCollaborateurDiplomes $magasinCollaborateurDiplome): self
{
if ($this->magasinCollaborateurDiplomes->removeElement($magasinCollaborateurDiplome)) {
// set the owning side to null (unless already changed)
if ($magasinCollaborateurDiplome->getMagasinCollaborateurs() === $this) {
$magasinCollaborateurDiplome->setMagasinCollaborateurs(null);
}
}
return $this;
}
/**
* @return mixed
*/
public function getSort()
{
return $this->sort;
}
public function setSort(mixed $sort): void
{
$this->sort = $sort;
}
public function __toString(): string{
return $this->firstname. " ".$this->lastname;
}
/**
* @return Collection|\App\Entity\Webfactory\Page\classique\Store[]
*/
public function getMagasins(): Collection
{
return $this->pagesMagasinClassique;
}
public function addMagasin(\App\Entity\Webfactory\Page\classique\Store $pageMagasinClassique): self
{
if (!$this->pagesMagasinClassique->contains($pageMagasinClassique)) {
$this->pagesMagasinClassique[] = $pageMagasinClassique;
$pageMagasinClassique->setEquipeVerbatim($this);
}
return $this;
}
public function removeMagasin(\App\Entity\Webfactory\Page\classique\Store $pageMagasinClassique): self
{
if ($this->pagesMagasinClassique->removeElement($pageMagasinClassique)) {
// set the owning side to null (unless already changed)
if ($pageMagasinClassique->getEquipeVerbatim() === $this) {
$pageMagasinClassique->setEquipeVerbatim(null);
}
}
return $this;
}
/**
* @return string
*/
public function getImage()
{
return $this->image;
}
/**
* @param string $image
*/
public function setImage($image): void
{
$this->image = $image;
}
/**
* @return string
*/
public function getJobsNl(): ?string
{
return $this->jobsNl;
}
/**
* @param string $jobsNl
*/
public function setJobsNl($jobsNl): void
{
$this->jobsNl = $jobsNl;
}
/**
* @return string
*/
public function getSpecialtiesNl()
{
return $this->specialtiesNl;
}
/**
* @param string $specialtiesNl
*/
public function setSpecialtiesNl($specialtiesNl): void
{
$this->specialtiesNl = $specialtiesNl;
}
/**
* @return string
*/
public function getVerbatimNl()
{
return $this->verbatimNl;
}
/**
* @param string $verbatimNl
*/
public function setVerbatimNl($verbatimNl)
{
$this->verbatimNl = $verbatimNl;
}
/**
* @return string
*/
public function getPresentationNl()
{
return $this->presentationNl;
}
/**
* @param string $presentationNl
*/
public function setPresentationNl($presentationNl)
{
$this->presentationNl = $presentationNl;
}
public function getPagesMagasinClassique(): ArrayCollection
{
return $this->pagesMagasinClassique;
}
public function setPagesMagasinClassique(ArrayCollection $pagesMagasinClassique): void
{
$this->pagesMagasinClassique = $pagesMagasinClassique;
}
}