<?php
namespace App\Entity;
use App\Entity\Trait\CodeTrait;
use App\Entity\Trait\CreatedAtTrait;
use App\Entity\Trait\SlugTrait;
use App\Repository\ArticlesRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: ArticlesRepository::class)]
class Articles
{
use CreatedAtTrait;
use SlugTrait;
use CodeTrait ;
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column()]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $libelle = null;
#[ORM\Column(type: Types::TEXT)]
private ?string $description = null;
#[ORM\Column(nullable: true)]
private ?int $prix = null;
#[ORM\Column]
private ?bool $ispromo = null;
#[ORM\Column]
private ?bool $IsSolde = null;
#[ORM\Column(nullable: true)]
private ?int $soldePourcentage = null;
#[ORM\Column(nullable: true)]
private ?int $prixpromo = null;
#[ORM\Column(length: 50)]
private ?string $etat = null;
#[ORM\Column(length: 255)]
private ?string $imageprincipale = null;
#[ORM\ManyToOne(inversedBy: 'articles')]
#[ORM\JoinColumn(nullable: false)]
private ?Categories $categorie = null;
#[ORM\Column]
private ?int $status = null;
// 0 annuler ,
// 1 non publier
// 2 publier
#[ORM\OneToMany(mappedBy: 'article', targetEntity: Images::class, orphanRemoval: true)]
private Collection $images;
#[ORM\ManyToOne(inversedBy: 'articles')]
#[ORM\JoinColumn(nullable: false)]
private ?User $createdBy = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $ville = null;
#[ORM\Column]
private ?bool $isNoprice = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $pubDate = null;
public function __construct()
{
$this->images = 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 getDescription(): ?string
{
return $this->description;
}
public function setDescription(string $description): self
{
$this->description = $description;
return $this;
}
public function getPrix(): ?int
{
return $this->prix;
}
public function setPrix(?int $prix): self
{
$this->prix = $prix;
return $this;
}
public function isIspromo(): ?bool
{
return $this->ispromo;
}
public function setIspromo(bool $ispromo): self
{
$this->ispromo = $ispromo;
return $this;
}
public function isIsSolde(): ?bool
{
return $this->IsSolde;
}
public function setIsSolde(bool $IsSolde): self
{
$this->IsSolde = $IsSolde;
return $this;
}
public function getSoldePourcentage(): ?int
{
return $this->soldePourcentage;
}
public function setSoldePourcentage(?int $soldePourcentage): self
{
$this->soldePourcentage = $soldePourcentage;
return $this;
}
public function getPrixpromo(): ?int
{
return $this->prixpromo;
}
public function setPrixpromo(?int $prixpromo): self
{
$this->prixpromo = $prixpromo;
return $this;
}
public function getEtat(): ?string
{
return $this->etat;
}
public function setEtat(string $etat): self
{
$this->etat = $etat;
return $this;
}
public function getImageprincipale(): ?string
{
return $this->imageprincipale;
}
public function setImageprincipale(string $imageprincipale): self
{
$this->imageprincipale = $imageprincipale;
return $this;
}
public function getCategorie(): ?Categories
{
return $this->categorie;
}
public function setCategorie(?Categories $categorie): self
{
$this->categorie = $categorie;
return $this;
}
public function getStatus(): ?int
{
return $this->status;
}
public function setStatus(int $status): self
{
$this->status = $status;
return $this;
}
/**
* @return Collection<int, Images>
*/
public function getImages(): Collection
{
return $this->images;
}
public function addImage(Images $image): self
{
if (!$this->images->contains($image)) {
$this->images[] = $image;
$image->setArticle($this);
}
return $this;
}
public function removeImage(Images $image): self
{
if ($this->images->removeElement($image)) {
// set the owning side to null (unless already changed)
if ($image->getArticle() === $this) {
$image->setArticle(null);
}
}
return $this;
}
public function getCreatedBy(): ?User
{
return $this->createdBy;
}
public function setCreatedBy(?User $createdBy): self
{
$this->createdBy = $createdBy;
return $this;
}
public function getVille(): ?string
{
return $this->ville;
}
public function setVille(?string $ville): self
{
$this->ville = $ville;
return $this;
}
public function isIsNoprice(): ?bool
{
return $this->isNoprice;
}
public function setIsNoprice(bool $isNoprice): self
{
$this->isNoprice = $isNoprice;
return $this;
}
public function getPubDate(): ?\DateTimeInterface
{
return $this->pubDate;
}
public function setPubDate(?\DateTimeInterface $pubDate): self
{
$this->pubDate = $pubDate;
return $this;
}
}