src/Entity/Fournisseurs/Categorie.php line 22

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Fournisseurs;
  3. use App\Entity\Utilisateur\Utilisateur;
  4. use DateTime;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Gedmo\Mapping\Annotation as Gedmo;
  9. use Symfony\Component\Validator\Constraints as Assert;
  10. use App\Annotations\SecuredEntity;
  11. /**
  12.  * Categorie
  13.  *
  14.  * @ORM\Table("fournisseur__categorie")
  15.  * @ORM\Entity(repositoryClass="App\Repository\Fournisseurs\CategorieRepository")
  16.  * @Gedmo\SoftDeleteable(fieldName="dateSuppression",timeAware=false)
  17.  * @SecuredEntity(name="Categorie", group="FOURNISSEURS")
  18.  */
  19. class Categorie
  20. {
  21.     /**
  22.      * @ORM\Column(name="id", type="integer")
  23.      * @ORM\Id
  24.      * @ORM\GeneratedValue(strategy="AUTO")
  25.      */
  26.     private $id;
  27.     /**
  28.      * @ORM\OneToMany(targetEntity="App\Entity\Fournisseurs\FournisseurCategorie", mappedBy="categorie")
  29.      */
  30.     private $fournisseurCategorie;
  31.     /**
  32.      * @ORM\Column(name="libelle", type="string", length=255, nullable=true)
  33.      * @Assert\NotBlank(message="LibellĂ© obligatoire")
  34.      */
  35.     private $libelle;
  36.     
  37.     /**
  38.      * @ORM\OneToMany(targetEntity="App\Entity\Fournisseurs\Fournisseur", mappedBy="categorie")
  39.     */
  40.     private $fournisseurs;
  41.     
  42.     /**
  43.      * @ORM\ManyToOne(targetEntity="App\Entity\Fournisseurs\Categorie", cascade={"persist"}, inversedBy="categoriesEnfant")
  44.      * @ORM\JoinColumn(nullable=true)
  45.      */
  46.     private $categorieParent;
  47.     
  48.     /**
  49.     * @ORM\OneToMany(targetEntity="App\Entity\Fournisseurs\Categorie", mappedBy="categorieParent")
  50.      * @ORM\OrderBy({"libelle" = "ASC"})
  51.     */
  52.     private $categoriesEnfant;     
  53.     
  54.     /**
  55.      * @ORM\ManyToOne(targetEntity="App\Entity\Utilisateur\Utilisateur", inversedBy="categorieFournisseurs")
  56.      * @ORM\JoinColumn(nullable=true)
  57.      */
  58.     private $utilisateur;    
  59.     /**
  60.      * @ORM\Column(name="date", type="datetime", nullable=true)
  61.      */
  62.     private $date;
  63.     /**
  64.      * @ORM\Column(name="dateSuppression", type="datetime", nullable=true)
  65.      */
  66.     private $dateSuppression;
  67.     /**
  68.      * @ORM\Column(name="dateMaj", type="datetime", nullable=true)
  69.      * @Gedmo\Timestampable(on="update")     
  70.      */
  71.     private $dateMaj;
  72.     /**
  73.      * @ORM\Column(name="statut", type="boolean", nullable=true)
  74.      */
  75.     private $statut;
  76.     /**
  77.      * @ORM\Column(name="idImport", type="string", length=255, nullable=true)
  78.      */
  79.     private $idImport;
  80.     
  81.     public function __construct()
  82.     {
  83.         $this->date                 = new Datetime();
  84.         $this->categoriesEnfant     = new ArrayCollection();
  85.         $this->fournisseurCategorie = new ArrayCollection();
  86.         $this->fournisseurs         = new ArrayCollection();
  87.         
  88.     }
  89.     public function getId(): int
  90.     {
  91.         return $this->id;
  92.     }
  93.     public function setLibelle(?string $libelle): Categorie
  94.     {
  95.         $this->libelle $libelle;
  96.         return $this;
  97.     }
  98.     public function getLibelle(): ?string
  99.     {
  100.         return $this->libelle;
  101.     }
  102.     public function setDate(?DateTime $date): Categorie
  103.     {
  104.         $this->date $date;
  105.         return $this;
  106.     }
  107.     public function getDate(): ?DateTime
  108.     {
  109.         return $this->date;
  110.     }
  111.     public function setDateSuppression(?DateTime $dateSuppression): Categorie
  112.     {
  113.         $this->dateSuppression $dateSuppression;
  114.         return $this;
  115.     }
  116.     public function getDateSuppression(): ?DateTime
  117.     {
  118.         return $this->dateSuppression;
  119.     }
  120.     public function setDateMaj(?DateTime $dateMaj): Categorie
  121.     {
  122.         $this->dateMaj $dateMaj;
  123.         return $this;
  124.     }
  125.     public function getDateMaj(): ?DateTime
  126.     {
  127.         return $this->dateMaj;
  128.     }
  129.     public function setStatut(?bool $statut): Categorie
  130.     {
  131.         $this->statut $statut;
  132.         return $this;
  133.     }
  134.     public function getStatut(): ?bool
  135.     {
  136.         return $this->statut;
  137.     }
  138.     public function setIdImport(?string $idImport): Categorie
  139.     {
  140.         $this->idImport $idImport;
  141.         return $this;
  142.     }
  143.     public function getIdImport(): ?string
  144.     {
  145.         return $this->idImport;
  146.     }
  147.     public function setUtilisateur(?Utilisateur $utilisateur): Categorie
  148.     {
  149.         $this->utilisateur $utilisateur;
  150.         return $this;
  151.     }
  152.     public function getUtilisateur(): ?Utilisateur
  153.     {
  154.         return $this->utilisateur;
  155.     }
  156.     public function setCategorieParent(?Categorie $categorieParent): Categorie
  157.     {
  158.         $this->categorieParent $categorieParent;
  159.         return $this;
  160.     }
  161.     public function getCategorieParent(): ?Categorie
  162.     {
  163.         return $this->categorieParent;
  164.     }
  165.     public function addFournisseur(Fournisseur $fournisseurs): Categorie
  166.     {
  167.         $this->fournisseurs[] = $fournisseurs;
  168.         return $this;
  169.     }
  170.     public function removeFournisseur(Fournisseur $fournisseurs)
  171.     {
  172.         $this->fournisseurs->removeElement($fournisseurs);
  173.     }
  174.     public function getFournisseurs(): Collection
  175.     {
  176.         return $this->fournisseurs;
  177.     }
  178.     public function addFournisseurCategorie(FournisseurCategorie $fournisseurCategorie): Categorie
  179.     {
  180.         $this->fournisseurCategorie[] = $fournisseurCategorie;
  181.         return $this;
  182.     }
  183.     public function removeFournisseurCategorie(FournisseurCategorie $fournisseurCategorie)
  184.     {
  185.         $this->fournisseurCategorie->removeElement($fournisseurCategorie);
  186.     }
  187.     /**
  188.      * Get fournisseurCategorie
  189.      *
  190.      * @return Collection
  191.      */
  192.     public function getFournisseurCategorie(): Collection
  193.     {
  194.         return $this->fournisseurCategorie;
  195.     }
  196.     public function addCategoriesEnfant(Categorie $categoriesEnfant): Categorie
  197.     {
  198.         $this->categoriesEnfant[] = $categoriesEnfant;
  199.         return $this;
  200.     }
  201.     public function removeCategoriesEnfant(Categorie $categoriesEnfant)
  202.     {
  203.         $this->categoriesEnfant->removeElement($categoriesEnfant);
  204.     }
  205.     public function getCategoriesEnfant(): Collection
  206.     {
  207.         return $this->categoriesEnfant;
  208.     }
  209. }