Deprecated: Constant E_STRICT is deprecated in /var/www/PixelForce/vendor/symfony/error-handler/ErrorHandler.php on line 58

Deprecated: Constant E_STRICT is deprecated in /var/www/PixelForce/vendor/symfony/error-handler/ErrorHandler.php on line 76
Symfony Profiler

src/Entity/Categorie.php line 81

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\CategorieRepository;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use JsonSerializable;
  7. use Doctrine\Common\Collections\ArrayCollection;
  8. /**
  9.  * @ORM\Entity(repositoryClass=CategorieRepository::class)
  10.  */
  11. class Categorie implements JsonSerializable
  12. {
  13.     /**
  14.      * @ORM\Id
  15.      * @ORM\GeneratedValue
  16.      * @ORM\Column(type="integer")
  17.      */
  18.     private $id;
  19.     /**
  20.      * @ORM\Column(type="string", length=255)
  21.      */
  22.     private $nom;
  23.     /**
  24.      * @ORM\Column(type="string", length=255, nullable=true)
  25.      */
  26.     private $description;
  27.     /**
  28.      * @ORM\OneToMany(targetEntity="Produit", mappedBy="categorie")
  29.      */
  30.     private $produits;
  31.     /**
  32.      * @ORM\Column(type="integer")
  33.      */
  34.     private $statut;
  35.     /**
  36.      * @ORM\ManyToOne(targetEntity=Secteur::class)
  37.      * @ORM\JoinColumn(nullable=false)
  38.      */
  39.     private $secteur;
  40.     public function __construct() {
  41.         $this->produits = new ArrayCollection();
  42.     }
  43.     public function getId(): ?int
  44.     {
  45.         return $this->id;
  46.     }
  47.     public function getNom(): ?string
  48.     {
  49.         return $this->nom;
  50.     }
  51.     public function setNom(string $nom): self
  52.     {
  53.         $this->nom $nom;
  54.         return $this;
  55.     }
  56.     public function getDescription(): ?string
  57.     {
  58.         return $this->description;
  59.     }
  60.     public function setDescription(?string $description): self
  61.     {
  62.         $this->description $description;
  63.         return $this;
  64.     }
  65.     public function jsonSerialize()
  66.     {
  67.         $vars get_object_vars($this);
  68.         return $vars;
  69.     }
  70.     public function getStatut(): ?int
  71.     {
  72.         return $this->statut;
  73.     }
  74.     public function setStatut(int $statut): self
  75.     {
  76.         $this->statut $statut;
  77.         return $this;
  78.     }
  79.     public function getSecteur(): ?Secteur
  80.     {
  81.         return $this->secteur;
  82.     }
  83.     public function setSecteur(?Secteur $secteur): self
  84.     {
  85.         $this->secteur $secteur;
  86.         return $this;
  87.     }
  88.     /**
  89.      * @return Collection<int, Produit>
  90.      */
  91.     public function getProduits(): Collection
  92.     {
  93.         return $this->produits;
  94.     }
  95.     public function addProduit(Produit $produit): static
  96.     {
  97.         if (!$this->produits->contains($produit)) {
  98.             $this->produits->add($produit);
  99.             $produit->setCategorie($this);
  100.         }
  101.         return $this;
  102.     }
  103.     public function removeProduit(Produit $produit): static
  104.     {
  105.         if ($this->produits->removeElement($produit)) {
  106.             // set the owning side to null (unless already changed)
  107.             if ($produit->getCategorie() === $this) {
  108.                 $produit->setCategorie(null);
  109.             }
  110.         }
  111.         return $this;
  112.     }
  113. }