src\Entity\Service.php line 10

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. #[ORM\Entity(repositoryClass\App\Repository\ServiceRepository::class)]
  7. class Service
  8. {
  9.     #[ORM\Id]
  10.     #[ORM\GeneratedValue]
  11.     #[ORM\Column(type'integer')]
  12.     private $id;
  13.     #[ORM\Column(type'string'length255)]
  14.     private $libelle;
  15.     #[ORM\Column(type'string'length255nullabletrue)]
  16.     private $typeservice;
  17.     #[ORM\Column(type'text'nullabletrue)]
  18.     private $description;
  19.     #[ORM\Column(type'datetime')]
  20.     private $createat;
  21.     #[ORM\Column(type'datetime'nullabletrue)]
  22.     private $updateat;
  23.     #[ORM\OneToMany(targetEntity\App\Entity\Produit::class, mappedBy'service')]
  24.     private $produit;
  25.     #[ORM\ManyToMany(targetEntity\App\Entity\Newsletter::class, mappedBy'service')]
  26.     private $newsletter;
  27.     
  28.     const type = ['M','Mme','Mlle'],
  29.         type_long =['Monsieur','Madame','Mademoiselle'];
  30.     public function __construct()
  31.     {
  32.         $this->produit = new ArrayCollection();
  33.         $this->createat=new \DateTime();
  34.         $this->newsletter = new ArrayCollection();
  35.     }
  36.     public function getId(): ?int
  37.     {
  38.         return $this->id;
  39.     }
  40.     public function getLibelle(): ?string
  41.     {
  42.         return $this->libelle;
  43.     }
  44.     public function setLibelle(string $libelle): self
  45.     {
  46.         $this->libelle $libelle;
  47.         return $this;
  48.     }
  49.     public function getTypeservice(): ?string
  50.     {
  51.         return $this->typeservice;
  52.     }
  53.     public function setTypeservice(?string $typeservice): self
  54.     {
  55.         $this->typeservice $typeservice;
  56.         return $this;
  57.     }
  58.     public function getDescription(): ?string
  59.     {
  60.         return $this->description;
  61.     }
  62.     public function setDescription(?string $description): self
  63.     {
  64.         $this->description $description;
  65.         return $this;
  66.     }
  67.     public function getCreateat(): ?\DateTimeInterface
  68.     {
  69.         return $this->createat;
  70.     }
  71.     public function setCreateat(\DateTimeInterface $createat): self
  72.     {
  73.         $this->createat $createat;
  74.         return $this;
  75.     }
  76.     public function getUpdateat(): ?\DateTimeInterface
  77.     {
  78.         return $this->updateat;
  79.     }
  80.     public function setUpdateat(?\DateTimeInterface $updateat): self
  81.     {
  82.         $this->updateat $updateat;
  83.         return $this;
  84.     }
  85.     /**
  86.      * @return Collection|Produit[]
  87.      */
  88.     public function getProduit(): Collection
  89.     {
  90.         return $this->produit;
  91.     }
  92.     public function addProduit(Produit $produit): self
  93.     {
  94.         if (!$this->produit->contains($produit)) {
  95.             $this->produit[] = $produit;
  96.             $produit->setService($this);
  97.         }
  98.         return $this;
  99.     }
  100.     public function removeProduit(Produit $produit): self
  101.     {
  102.         if ($this->produit->contains($produit)) {
  103.             $this->produit->removeElement($produit);
  104.             // set the owning side to null (unless already changed)
  105.             if ($produit->getService() === $this) {
  106.                 $produit->setService(null);
  107.             }
  108.         }
  109.         return $this;
  110.     }
  111.     /**
  112.      * @return Collection|Newsletter[]
  113.      */
  114.     public function getNewsletter(): Collection
  115.     {
  116.         return $this->newsletter;
  117.     }
  118.     public function addNewsletter(Newsletter $newsletter): self
  119.     {
  120.         if (!$this->newsletter->contains($newsletter)) {
  121.             $this->newsletter[] = $newsletter;
  122.             $newsletter->addService($this);
  123.         }
  124.         return $this;
  125.     }
  126.     public function removeNewsletter(Newsletter $newsletter): self
  127.     {
  128.         if ($this->newsletter->contains($newsletter)) {
  129.             $this->newsletter->removeElement($newsletter);
  130.             $newsletter->removeService($this);
  131.         }
  132.         return $this;
  133.     }
  134. }