src/Entity/Inventaires/Type.php line 20

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Inventaires;
  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. /**
  11.  * Type
  12.  *
  13.  * @ORM\Table("inventaire__type")
  14.  * @ORM\Entity(repositoryClass="App\Repository\Inventaires\TypeRepository")
  15.  * @Gedmo\SoftDeleteable(fieldName="dateSuppression",timeAware=false)
  16.  */
  17. class Type
  18. {
  19.     /**
  20.      * @ORM\Column(name="id", type="integer")
  21.      * @ORM\Id
  22.      * @ORM\GeneratedValue(strategy="AUTO")
  23.      */
  24.     private $id;
  25.     
  26.     /**
  27.      * @ORM\ManyToOne(targetEntity="App\Entity\Utilisateur\Utilisateur", inversedBy="typesInventaire")
  28.      * @ORM\JoinColumn(nullable=true)
  29.      */
  30.     private $utilisateur;
  31.     /**
  32.      * @ORM\Column(name="libelle", type="string", length=255, nullable=true)
  33.      */
  34.     private $libelle;
  35.     /**
  36.      * @ORM\Column(name="date", type="datetime", nullable=true)
  37.      */
  38.     private $date;
  39.     /**
  40.      * @ORM\Column(name="dateSuppression", type="datetime", nullable=true)
  41.      */
  42.     private $dateSuppression;
  43.     
  44.     /**
  45.     * @ORM\OneToMany(targetEntity="App\Entity\Inventaires\Inventaire", cascade={"persist"}, mappedBy="type")
  46.     */
  47.     private $inventaires;
  48.     
  49.     public function __construct()
  50.     {
  51.     $this->date         = new Datetime();
  52.     $this->inventaires  = new ArrayCollection();
  53.     }   
  54.     
  55.     /**
  56.     * toString
  57.     * @return string
  58.     */
  59.    public function __toString()
  60.    {
  61.        return $this->getLibelle();
  62.    }
  63.     public function getId(): int
  64.     {
  65.         return $this->id;
  66.     }
  67.     public function setLibelle(?string $libelle): Type
  68.     {
  69.         $this->libelle $libelle;
  70.         return $this;
  71.     }
  72.     public function getLibelle(): ?string
  73.     {
  74.         return $this->libelle;
  75.     }
  76.     public function setDate(?DateTime $date): Type
  77.     {
  78.         $this->date $date;
  79.         return $this;
  80.     }
  81.     public function getDate(): ?DateTime
  82.     {
  83.         return $this->date;
  84.     }
  85.     public function setDateSuppression(?DateTime $dateSuppression): Type
  86.     {
  87.         $this->dateSuppression $dateSuppression;
  88.         return $this;
  89.     }
  90.     public function getDateSuppression(): ?DateTime
  91.     {
  92.         return $this->dateSuppression;
  93.     }
  94.     public function setUtilisateur(?Utilisateur $utilisateur): Type
  95.     {
  96.         $this->utilisateur $utilisateur;
  97.         return $this;
  98.     }
  99.     public function getUtilisateur(): ?Utilisateur
  100.     {
  101.         return $this->utilisateur;
  102.     }
  103.     public function addInventaire(Inventaire $inventaire): Type
  104.     {
  105.         $this->inventaires[] = $inventaire;
  106.         return $this;
  107.     }
  108.     public function removeInventaire(Inventaire $inventaire)
  109.     {
  110.         $this->inventaires->removeElement($inventaire);
  111.     }
  112.     public function getInventaires(): Collection
  113.     {
  114.         return $this->inventaires;
  115.     }
  116. }