<?php
namespace App\Entity\Fournisseurs;
use App\Entity\Utilisateur\Utilisateur;
use DateTime;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Symfony\Component\Validator\Constraints as Assert;
use App\Annotations\SecuredEntity;
/**
* Categorie
*
* @ORM\Table("fournisseur__categorie")
* @ORM\Entity(repositoryClass="App\Repository\Fournisseurs\CategorieRepository")
* @Gedmo\SoftDeleteable(fieldName="dateSuppression",timeAware=false)
* @SecuredEntity(name="Categorie", group="FOURNISSEURS")
*/
class Categorie
{
/**
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Fournisseurs\FournisseurCategorie", mappedBy="categorie")
*/
private $fournisseurCategorie;
/**
* @ORM\Column(name="libelle", type="string", length=255, nullable=true)
* @Assert\NotBlank(message="Libellé obligatoire")
*/
private $libelle;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Fournisseurs\Fournisseur", mappedBy="categorie")
*/
private $fournisseurs;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Fournisseurs\Categorie", cascade={"persist"}, inversedBy="categoriesEnfant")
* @ORM\JoinColumn(nullable=true)
*/
private $categorieParent;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Fournisseurs\Categorie", mappedBy="categorieParent")
* @ORM\OrderBy({"libelle" = "ASC"})
*/
private $categoriesEnfant;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Utilisateur\Utilisateur", inversedBy="categorieFournisseurs")
* @ORM\JoinColumn(nullable=true)
*/
private $utilisateur;
/**
* @ORM\Column(name="date", type="datetime", nullable=true)
*/
private $date;
/**
* @ORM\Column(name="dateSuppression", type="datetime", nullable=true)
*/
private $dateSuppression;
/**
* @ORM\Column(name="dateMaj", type="datetime", nullable=true)
* @Gedmo\Timestampable(on="update")
*/
private $dateMaj;
/**
* @ORM\Column(name="statut", type="boolean", nullable=true)
*/
private $statut;
/**
* @ORM\Column(name="idImport", type="string", length=255, nullable=true)
*/
private $idImport;
public function __construct()
{
$this->date = new Datetime();
$this->categoriesEnfant = new ArrayCollection();
$this->fournisseurCategorie = new ArrayCollection();
$this->fournisseurs = new ArrayCollection();
}
public function getId(): int
{
return $this->id;
}
public function setLibelle(?string $libelle): Categorie
{
$this->libelle = $libelle;
return $this;
}
public function getLibelle(): ?string
{
return $this->libelle;
}
public function setDate(?DateTime $date): Categorie
{
$this->date = $date;
return $this;
}
public function getDate(): ?DateTime
{
return $this->date;
}
public function setDateSuppression(?DateTime $dateSuppression): Categorie
{
$this->dateSuppression = $dateSuppression;
return $this;
}
public function getDateSuppression(): ?DateTime
{
return $this->dateSuppression;
}
public function setDateMaj(?DateTime $dateMaj): Categorie
{
$this->dateMaj = $dateMaj;
return $this;
}
public function getDateMaj(): ?DateTime
{
return $this->dateMaj;
}
public function setStatut(?bool $statut): Categorie
{
$this->statut = $statut;
return $this;
}
public function getStatut(): ?bool
{
return $this->statut;
}
public function setIdImport(?string $idImport): Categorie
{
$this->idImport = $idImport;
return $this;
}
public function getIdImport(): ?string
{
return $this->idImport;
}
public function setUtilisateur(?Utilisateur $utilisateur): Categorie
{
$this->utilisateur = $utilisateur;
return $this;
}
public function getUtilisateur(): ?Utilisateur
{
return $this->utilisateur;
}
public function setCategorieParent(?Categorie $categorieParent): Categorie
{
$this->categorieParent = $categorieParent;
return $this;
}
public function getCategorieParent(): ?Categorie
{
return $this->categorieParent;
}
public function addFournisseur(Fournisseur $fournisseurs): Categorie
{
$this->fournisseurs[] = $fournisseurs;
return $this;
}
public function removeFournisseur(Fournisseur $fournisseurs)
{
$this->fournisseurs->removeElement($fournisseurs);
}
public function getFournisseurs(): Collection
{
return $this->fournisseurs;
}
public function addFournisseurCategorie(FournisseurCategorie $fournisseurCategorie): Categorie
{
$this->fournisseurCategorie[] = $fournisseurCategorie;
return $this;
}
public function removeFournisseurCategorie(FournisseurCategorie $fournisseurCategorie)
{
$this->fournisseurCategorie->removeElement($fournisseurCategorie);
}
/**
* Get fournisseurCategorie
*
* @return Collection
*/
public function getFournisseurCategorie(): Collection
{
return $this->fournisseurCategorie;
}
public function addCategoriesEnfant(Categorie $categoriesEnfant): Categorie
{
$this->categoriesEnfant[] = $categoriesEnfant;
return $this;
}
public function removeCategoriesEnfant(Categorie $categoriesEnfant)
{
$this->categoriesEnfant->removeElement($categoriesEnfant);
}
public function getCategoriesEnfant(): Collection
{
return $this->categoriesEnfant;
}
}