src/Entity/Articles.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Trait\CodeTrait;
  4. use App\Entity\Trait\CreatedAtTrait;
  5. use App\Entity\Trait\SlugTrait;
  6. use App\Repository\ArticlesRepository;
  7. use Doctrine\Common\Collections\ArrayCollection;
  8. use Doctrine\Common\Collections\Collection;
  9. use Doctrine\DBAL\Types\Types;
  10. use Doctrine\ORM\Mapping as ORM;
  11. #[ORM\Entity(repositoryClassArticlesRepository::class)]
  12. class Articles
  13. {
  14.     use CreatedAtTrait;
  15.     use SlugTrait;
  16.     use CodeTrait ;
  17.     #[ORM\Id]
  18.     #[ORM\GeneratedValue]
  19.     #[ORM\Column()]
  20.     private ?int $id null;
  21.     #[ORM\Column(length255)]
  22.     private ?string $libelle null;
  23.     #[ORM\Column(typeTypes::TEXT)]
  24.     private ?string $description null;
  25.     #[ORM\Column(nullabletrue)]
  26.     private ?int $prix null;
  27.     #[ORM\Column]
  28.     private ?bool $ispromo null;
  29.     #[ORM\Column]
  30.     private ?bool $IsSolde null;
  31.     #[ORM\Column(nullabletrue)]
  32.     private ?int $soldePourcentage null;
  33.     #[ORM\Column(nullabletrue)]
  34.     private ?int $prixpromo null;
  35.     #[ORM\Column(length50)]
  36.     private ?string $etat null;
  37.     #[ORM\Column(length255)]
  38.     private ?string $imageprincipale null;
  39.     #[ORM\ManyToOne(inversedBy'articles')]
  40.     #[ORM\JoinColumn(nullablefalse)]
  41.     private ?Categories $categorie null;
  42.     #[ORM\Column]
  43.     private ?int $status null;
  44.     // 0 annuler  ,
  45.     // 1 non publier
  46.     // 2 publier
  47.     #[ORM\OneToMany(mappedBy'article'targetEntityImages::class, orphanRemovaltrue)]
  48.     private Collection $images;
  49.     #[ORM\ManyToOne(inversedBy'articles')]
  50.     #[ORM\JoinColumn(nullablefalse)]
  51.     private ?User $createdBy null;
  52.     #[ORM\Column(length255nullabletrue)]
  53.     private ?string $ville null;
  54.     #[ORM\Column]
  55.     private ?bool $isNoprice null;
  56.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  57.     private ?\DateTimeInterface $pubDate null;
  58.     public function __construct()
  59.     {
  60.         $this->images = new ArrayCollection();
  61.     }
  62.     public function getId(): ?int
  63.     {
  64.         return $this->id;
  65.     }
  66.     public function getLibelle(): ?string
  67.     {
  68.         return $this->libelle;
  69.     }
  70.     public function setLibelle(string $libelle): self
  71.     {
  72.         $this->libelle $libelle;
  73.         return $this;
  74.     }
  75.     public function getDescription(): ?string
  76.     {
  77.         return $this->description;
  78.     }
  79.     public function setDescription(string $description): self
  80.     {
  81.         $this->description $description;
  82.         return $this;
  83.     }
  84.     public function getPrix(): ?int
  85.     {
  86.         return $this->prix;
  87.     }
  88.     public function setPrix(?int $prix): self
  89.     {
  90.         $this->prix $prix;
  91.         return $this;
  92.     }
  93.     public function isIspromo(): ?bool
  94.     {
  95.         return $this->ispromo;
  96.     }
  97.     public function setIspromo(bool $ispromo): self
  98.     {
  99.         $this->ispromo $ispromo;
  100.         return $this;
  101.     }
  102.     public function isIsSolde(): ?bool
  103.     {
  104.         return $this->IsSolde;
  105.     }
  106.     public function setIsSolde(bool $IsSolde): self
  107.     {
  108.         $this->IsSolde $IsSolde;
  109.         return $this;
  110.     }
  111.     public function getSoldePourcentage(): ?int
  112.     {
  113.         return $this->soldePourcentage;
  114.     }
  115.     public function setSoldePourcentage(?int $soldePourcentage): self
  116.     {
  117.         $this->soldePourcentage $soldePourcentage;
  118.         return $this;
  119.     }
  120.     public function getPrixpromo(): ?int
  121.     {
  122.         return $this->prixpromo;
  123.     }
  124.     public function setPrixpromo(?int $prixpromo): self
  125.     {
  126.         $this->prixpromo $prixpromo;
  127.         return $this;
  128.     }
  129.     public function getEtat(): ?string
  130.     {
  131.         return $this->etat;
  132.     }
  133.     public function setEtat(string $etat): self
  134.     {
  135.         $this->etat $etat;
  136.         return $this;
  137.     }
  138.     public function getImageprincipale(): ?string
  139.     {
  140.         return $this->imageprincipale;
  141.     }
  142.     public function setImageprincipale(string $imageprincipale): self
  143.     {
  144.         $this->imageprincipale $imageprincipale;
  145.         return $this;
  146.     }
  147.     public function getCategorie(): ?Categories
  148.     {
  149.         return $this->categorie;
  150.     }
  151.     public function setCategorie(?Categories $categorie): self
  152.     {
  153.         $this->categorie $categorie;
  154.         return $this;
  155.     }
  156.     public function getStatus(): ?int
  157.     {
  158.         return $this->status;
  159.     }
  160.     public function setStatus(int $status): self
  161.     {
  162.         $this->status $status;
  163.         return $this;
  164.     }
  165.     /**
  166.      * @return Collection<int, Images>
  167.      */
  168.     public function getImages(): Collection
  169.     {
  170.         return $this->images;
  171.     }
  172.     public function addImage(Images $image): self
  173.     {
  174.         if (!$this->images->contains($image)) {
  175.             $this->images[] = $image;
  176.             $image->setArticle($this);
  177.         }
  178.         return $this;
  179.     }
  180.     public function removeImage(Images $image): self
  181.     {
  182.         if ($this->images->removeElement($image)) {
  183.             // set the owning side to null (unless already changed)
  184.             if ($image->getArticle() === $this) {
  185.                 $image->setArticle(null);
  186.             }
  187.         }
  188.         return $this;
  189.     }
  190.     public function getCreatedBy(): ?User
  191.     {
  192.         return $this->createdBy;
  193.     }
  194.     public function setCreatedBy(?User $createdBy): self
  195.     {
  196.         $this->createdBy $createdBy;
  197.         return $this;
  198.     }
  199.     public function getVille(): ?string
  200.     {
  201.         return $this->ville;
  202.     }
  203.     public function setVille(?string $ville): self
  204.     {
  205.         $this->ville $ville;
  206.         return $this;
  207.     }
  208.     public function isIsNoprice(): ?bool
  209.     {
  210.         return $this->isNoprice;
  211.     }
  212.     public function setIsNoprice(bool $isNoprice): self
  213.     {
  214.         $this->isNoprice $isNoprice;
  215.         return $this;
  216.     }
  217.     public function getPubDate(): ?\DateTimeInterface
  218.     {
  219.         return $this->pubDate;
  220.     }
  221.     public function setPubDate(?\DateTimeInterface $pubDate): self
  222.     {
  223.         $this->pubDate $pubDate;
  224.         return $this;
  225.     }
  226. }