src/Entity/Training/Creval.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Training;
  3. use ApiPlatform\Core\Annotation\ApiResource;
  4. use App\Repository\Training\CrevalRepository;
  5. use App\Traits\Actions;
  6. use App\Entity\Training\Nsti;
  7. use Doctrine\Common\Collections\ArrayCollection;
  8. use Doctrine\Common\Collections\Collection;
  9. use Doctrine\ORM\Mapping as ORM;
  10. #[ORM\Entity(repositoryClassCrevalRepository::class)]
  11. #[ORM\Table(name'hs_tc_training_creval')]
  12. #[ApiResource]
  13. class Creval implements \Stringable
  14. {
  15.     use Actions;
  16.     #[ORM\Column(name"name"type"string"length255)]
  17.     private $name;
  18.     #[ORM\Column(name"abbrev"type"string"length255)]
  19.     private ?string $abbrev null;
  20.     #[ORM\Column(name"coefficient"type"integer"length255)]
  21.     private ?int $coefficient null;
  22.     #[ORM\OneToMany(mappedBy"creval"targetEntityNsti::class, cascade: ["persist"], orphanRemovaltrue)]
  23.     private Collection $nstis;
  24.     public function __construct()
  25.     {
  26.         // date_default_timezone_set('Africa/Casablanca');
  27.         $this->createAt=new \DateTime('now');
  28.         $this->published=false;
  29.         $this->nstis=new ArrayCollection();
  30.     }
  31.     /**
  32.      * @return string
  33.      */
  34.     public function getAbbrev(): ?string
  35.     {
  36.         return $this->abbrev;
  37.     }
  38.     /**
  39.      * @param string $abbrev
  40.      */
  41.     public function setAbbrev(?string $abbrev): Creval
  42.     {
  43.         $this->abbrev $abbrev;
  44.         return $this;
  45.     }
  46.     /**
  47.      * Set nom
  48.      *
  49.      * @param string $name
  50.      * @return Creval
  51.      */
  52.     public function setName($name)
  53.     {
  54.         $this->name $name;
  55.         return $this;
  56.     }
  57.     /**
  58.      * Get name
  59.      *
  60.      * @return string
  61.      */
  62.     public function getName()
  63.     {
  64.         return $this->name;
  65.     }
  66.     function __toString(): string
  67.     {
  68.         return (string) $this->name;
  69.     }
  70.     /**
  71.      * @return integer
  72.      */
  73.     public function getCoefficient(): ?int
  74.     {
  75.         return $this->coefficient;
  76.     }
  77.     /**
  78.      * @param integer $coefficient
  79.      */
  80.     public function setCoefficient(?int $coefficient): Creval
  81.     {
  82.         $this->coefficient $coefficient;
  83.         return $this;
  84.     }
  85.     /**
  86.      * Add nsti
  87.      *
  88.      *
  89.      * @return Creval
  90.      */
  91.     public function addNsti(Nsti $nsti)
  92.     {
  93.         $nsti->setCreval($this);
  94.         $this->nstis[] = $nsti;
  95.         return $this;
  96.     }
  97.     /**
  98.      * Remove nsti
  99.      */
  100.     public function removeNsti(Nsti $nsti)
  101.     {
  102.         $this->nstis->removeElement($nsti);
  103.     }
  104.     /**
  105.      * Get nstis
  106.      *
  107.      * @return Collection
  108.      */
  109.     public function getNstis()
  110.     {
  111.         return $this->nstis;
  112.     }
  113. }