src/Entity/Produit/Produit/Caracteristique.php line 20

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Produit\Produit;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use App\Validator\Validatortext\Taillemin;
  5. use App\Validator\Validatortext\Taillemax;
  6. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  7. use App\Repository\Produit\Produit\CaracteristiqueRepository;
  8. use App\Entity\Produit\Produit\Caracteristiqueproduit;
  9. use App\Entity\Users\User\User;
  10. use Doctrine\Common\Collections\Collection;
  11. /**
  12.  * Caracteristique
  13.  *
  14.  * @ORM\Table("caracteristique")
  15.  * @ORM\Entity(repositoryClass=CaracteristiqueRepository::class)
  16.  * @UniqueEntity(fields="nom", message="Cette  offre existe déjà.")
  17.  */
  18. class Caracteristique
  19. {
  20.     /**
  21.      * @var integer
  22.      *
  23.      * @ORM\Column(name="id", type="integer")
  24.      * @ORM\Id
  25.      * @ORM\GeneratedValue(strategy="AUTO")
  26.      */
  27.     private $id;
  28.     /**
  29.      * @var string
  30.      *
  31.      * @ORM\Column(name="nom", type="string", length=255)
  32.      *@Taillemin(valeur=2, message="Au moins 2 caractères")
  33.      *@Taillemax(valeur=250, message="Au plus 250 caractès")
  34.      */
  35.     private $nom;
  36.     
  37.     /**
  38.      * @var string
  39.      *
  40.      * @ORM\Column(name="description", type="string", length=255, nullable=true)
  41.      *@Taillemax(valeur=800, message="Au plus 800 caractès")
  42.      */
  43.     private $description;
  44.     /**
  45.      * @var \DateTime
  46.      *
  47.      * @ORM\Column(name="date", type="datetime")
  48.      */
  49.     private $date;
  50.     
  51.     /**
  52.      * @var integer
  53.      *
  54.      * @ORM\Column(name="rang", type="integer")
  55.      */
  56.     private $rang;
  57.     
  58.     /**
  59.      * @ORM\OneToMany(targetEntity=Caracteristiqueproduit::class, mappedBy="caracteristique")
  60.      */
  61.     private $caracteristiqueproduits;
  62.     /**
  63.       * @ORM\ManyToOne(targetEntity=User::class)
  64.       * @ORM\JoinColumn(nullable=false)
  65.       */
  66.     private $user;
  67.       
  68.     public function __construct()
  69.     {
  70.         $this->date = new \Datetime();
  71.         $this->rang 0;
  72.         $this->caracteristiqueproduits = new \Doctrine\Common\Collections\ArrayCollection();
  73.     }
  74.     /**
  75.      * Get id
  76.      *
  77.      * @return integer 
  78.      */
  79.     public function getId()
  80.     {
  81.         return $this->id;
  82.     }
  83.     /**
  84.      * Set nom
  85.      *
  86.      * @param string $nom
  87.      * @return Caracteristique
  88.      */
  89.     public function setNom($nom)
  90.     {
  91.         $this->nom $nom;
  92.         return $this;
  93.     }
  94.     /**
  95.      * Get nom
  96.      *
  97.      * @return string 
  98.      */
  99.     public function getNom()
  100.     {
  101.         return $this->nom;
  102.     }
  103.     /**
  104.      * Set date
  105.      *
  106.      * @param \DateTime $date
  107.      * @return Caracteristique
  108.      */
  109.     public function setDate($date)
  110.     {
  111.         $this->date $date;
  112.         return $this;
  113.     }
  114.     /**
  115.      * Get date
  116.      *
  117.      * @return \DateTime 
  118.      */
  119.     public function getDate()
  120.     {
  121.         return $this->date;
  122.     }
  123.     /**
  124.      * Set user
  125.      * @return Caracteristique
  126.      */
  127.     public function setUser(User $user): self
  128.     {
  129.         $this->user $user;
  130.         return $this;
  131.     }
  132.     /**
  133.      * Get user
  134.      */
  135.     public function getUser(): ?User
  136.     {
  137.         return $this->user;
  138.     }
  139.     /**
  140.      * Set description
  141.      *
  142.      * @param string $description
  143.      * @return Caracteristique
  144.      */
  145.     public function setDescription($description)
  146.     {
  147.         $this->description $description;
  148.         return $this;
  149.     }
  150.     /**
  151.      * Get description
  152.      *
  153.      * @return string 
  154.      */
  155.     public function getDescription()
  156.     {
  157.         return $this->description;
  158.     }
  159.     /**
  160.      * Add caracteristiqueproduits
  161.      * @return Caracteristique
  162.      */
  163.     public function addCaracteristiqueproduit(Caracteristiqueproduit $caracteristiqueproduits): self
  164.     {
  165.         $this->caracteristiqueproduits[] = $caracteristiqueproduits;
  166.         return $this;
  167.     }
  168.     /**
  169.      * Remove caracteristiqueproduits
  170.      */
  171.     public function removeCaracteristiqueproduit(Caracteristiqueproduit $caracteristiqueproduits)
  172.     {
  173.         $this->caracteristiqueproduits->removeElement($caracteristiqueproduits);
  174.     }
  175.     /**
  176.      * Get caracteristiqueproduits 
  177.      */
  178.     public function getCaracteristiqueproduits(): ?Collection
  179.     {
  180.         return $this->caracteristiqueproduits;
  181.     }
  182.     /**
  183.      * Set rang
  184.      *
  185.      * @param integer $rang
  186.      * @return Caracteristique
  187.      */
  188.     public function setRang($rang)
  189.     {
  190.         $this->rang $rang;
  191.         return $this;
  192.     }
  193.     /**
  194.      * Get rang
  195.      *
  196.      * @return integer 
  197.      */
  198.     public function getRang()
  199.     {
  200.         return $this->rang;
  201.     }
  202. }