src/Entity/cat.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Symfony\Component\Validator\Validation;
  5. use Symfony\Component\Validator\Constraints as Assert;
  6. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  7. use App\Repository\catRepository;
  8. #[ORM\Entity(repositoryClasscatRepository::class)]
  9. #[ORM\Table(name"cat"options: ["comment"=> "Catégories utilisateurs"])]
  10. class cat
  11. {
  12.     
  13.     #[ORM\Id]
  14.     #[ORM\GeneratedValue(strategy"IDENTITY")]
  15.     #[ORM\Column(name"catid"type"integer"options: ["comment" => "Id catégorie"])]
  16.     private $catid;
  17.     #[ORM\Column(name"catlib"type"string"length100nullablefalseuniquetrueoptions: ["comment"=> "Libellé catégorie"])]
  18.     private $catlib;
  19.     #[Assert\Range(
  20.         min0,
  21.         max128,
  22.         notInRangeMessage'You must be between {{ min }}cm and {{ max }}cm tall to enter',
  23.     )]
  24.     #[ORM\Column(name"catord"type"smallint"options: ["default"=>1"comment"=>"Ordre affichage catégories"])]
  25.     private $catord;
  26.     #[ORM\OneToMany(targetEntity:"usr"mappedBy:"catid"cascade:["persist","remove"], orphanRemoval:true)]
  27.     private $usrids;
  28.     public function __construct()
  29.     {
  30.         //parent::__construct();
  31.         $this->usrids = new \Doctrine\Common\Collections\ArrayCollection();
  32.     }
  33.     public function getCatid(): ?int
  34.     {
  35.         return $this->catid;
  36.     }
  37.     /**
  38.      * Get catlib
  39.      */
  40.     public function getCatlib(): ?string 
  41.     {
  42.         return $this->catlib;
  43.     }
  44.     /**
  45.      * Set catlib
  46.      */
  47.     public function setCatlib(?string $catlib): static
  48.     {
  49.         $this->catlib $catlib;
  50.         return $this;
  51.     }
  52.     /**
  53.      * Get catord
  54.      */
  55.     public function getCatord(): ?int
  56.     {
  57.         return $this->catord;
  58.     }
  59.     /**
  60.      * Set catord
  61.      */
  62.     public function setCatord(?string $catord): static
  63.     {
  64.         $this->catord $catord;
  65.         return $this;
  66.     }
  67.     /*
  68.         OneToMany usr
  69.     */
  70.     public function getUsrids()
  71.     {
  72.         return $this->usrids;
  73.     }
  74.     public function addUsrid(\App\Entity\usr $usrid)
  75.     {
  76.         $this->usrids[] = $usrid;
  77.         $usrid->setcatid($this);
  78.         return $this;
  79.     }
  80.     public function removeUsrid(\App\Entity\usr $usrid)
  81.     {
  82.         $this->usrids->removeElement($usrid);
  83.     }
  84. }