<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: \App\Repository\ServiceRepository::class)]
class Service
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\Column(type: 'string', length: 255)]
private $libelle;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $typeservice;
#[ORM\Column(type: 'text', nullable: true)]
private $description;
#[ORM\Column(type: 'datetime')]
private $createat;
#[ORM\Column(type: 'datetime', nullable: true)]
private $updateat;
#[ORM\OneToMany(targetEntity: \App\Entity\Produit::class, mappedBy: 'service')]
private $produit;
#[ORM\ManyToMany(targetEntity: \App\Entity\Newsletter::class, mappedBy: 'service')]
private $newsletter;
const type = ['M','Mme','Mlle'],
type_long =['Monsieur','Madame','Mademoiselle'];
public function __construct()
{
$this->produit = new ArrayCollection();
$this->createat=new \DateTime();
$this->newsletter = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getLibelle(): ?string
{
return $this->libelle;
}
public function setLibelle(string $libelle): self
{
$this->libelle = $libelle;
return $this;
}
public function getTypeservice(): ?string
{
return $this->typeservice;
}
public function setTypeservice(?string $typeservice): self
{
$this->typeservice = $typeservice;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getCreateat(): ?\DateTimeInterface
{
return $this->createat;
}
public function setCreateat(\DateTimeInterface $createat): self
{
$this->createat = $createat;
return $this;
}
public function getUpdateat(): ?\DateTimeInterface
{
return $this->updateat;
}
public function setUpdateat(?\DateTimeInterface $updateat): self
{
$this->updateat = $updateat;
return $this;
}
/**
* @return Collection|Produit[]
*/
public function getProduit(): Collection
{
return $this->produit;
}
public function addProduit(Produit $produit): self
{
if (!$this->produit->contains($produit)) {
$this->produit[] = $produit;
$produit->setService($this);
}
return $this;
}
public function removeProduit(Produit $produit): self
{
if ($this->produit->contains($produit)) {
$this->produit->removeElement($produit);
// set the owning side to null (unless already changed)
if ($produit->getService() === $this) {
$produit->setService(null);
}
}
return $this;
}
/**
* @return Collection|Newsletter[]
*/
public function getNewsletter(): Collection
{
return $this->newsletter;
}
public function addNewsletter(Newsletter $newsletter): self
{
if (!$this->newsletter->contains($newsletter)) {
$this->newsletter[] = $newsletter;
$newsletter->addService($this);
}
return $this;
}
public function removeNewsletter(Newsletter $newsletter): self
{
if ($this->newsletter->contains($newsletter)) {
$this->newsletter->removeElement($newsletter);
$newsletter->removeService($this);
}
return $this;
}
}