src/Entity/Tutoring/Subject.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Tutoring;
  3. use ApiPlatform\Core\Annotation\ApiResource;
  4. use App\Repository\Tutoring\SubjectRepository;
  5. use App\Traits\Actions;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Component\HttpFoundation\File\UploadedFile;
  9. /**
  10.  * Subject
  11.  */
  12. #[ORM\Entity(repositoryClassSubjectRepository::class)]
  13. #[ORM\Table(name'hs_tc_tutoring_subject')]
  14. #[ApiResource]
  15. class Subject implements \Stringable
  16. {
  17.     use Actions;
  18.     /**
  19.      * @var string
  20.      */
  21.     #[ORM\Column(name'name'type'string'length255)]
  22.     private $name;
  23.     #[ORM\OneToMany(mappedBy'subject'targetEntityCourse::class, cascade: ['persist'], orphanRemovaltrue)]
  24.     private ?Collection $courses null;
  25.     /**
  26.      * @var string
  27.      */
  28.     #[ORM\Column(name'image1_name'type'string'length255nullabletrue)]
  29.     protected $image1Name;
  30.     protected $image1File;
  31.     public function __construct()
  32.     {
  33.         
  34.         $this->createAt=new \DateTime('now');
  35.         $this->published=true;
  36.     }
  37.     /**
  38.      * Get id
  39.      *
  40.      * @return integer 
  41.      */
  42.     public function getId()
  43.     {
  44.         return $this->id;
  45.     }
  46.     /**
  47.      * Set nom
  48.      *
  49.      * @param string $name
  50.      * @return Subject
  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 $this->name;
  69.     }
  70.     /**
  71.      * Add rowscourse
  72.      *
  73.      *
  74.      * @return Subject
  75.      */
  76.     public function addCourse(Course $course)
  77.     {
  78.         $course->setSubject($this);
  79.         $this->courses[] = $course;
  80.         return $this;
  81.     }
  82.     /**
  83.      * Remove course
  84.      */
  85.     public function removeCourse(Course $course)
  86.     {
  87.         $this->courses->removeElement($course);
  88.     }
  89.     /**
  90.      * Get courses
  91.      *
  92.      * @return \Doctrine\Common\Collections\Collection
  93.      */
  94.     public function getCourses()
  95.     {
  96.         return $this->courses;
  97.     }
  98.     /**
  99.      * @return string
  100.      */
  101.     public function getImage1Name()
  102.     {
  103.         return $this->image1Name;
  104.     }
  105.     /**
  106.      * @param string $image1Name
  107.      * @return Subject
  108.      */
  109.     public function setImage1Name($image1Name)
  110.     {
  111.         $this->image1Name $image1Name;
  112.         return $this;
  113.     }
  114.     /**
  115.      * @return mixed
  116.      */
  117.     public function getImage1File()
  118.     {
  119.         return $this->image1File;
  120.     }
  121.     /**
  122.      * @param mixed $image1File
  123.      * @return Subject
  124.      */
  125.     public function setImage1File(UploadedFile $image1File=null)
  126.     {
  127.         $this->image1File $image1File;
  128.         return $this;
  129.     }
  130. }