<?phpnamespace App\Entity\Tutoring;use ApiPlatform\Core\Annotation\ApiResource;use App\Repository\Tutoring\SubjectRepository;use App\Traits\Actions;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\HttpFoundation\File\UploadedFile;/** * Subject */#[ORM\Entity(repositoryClass: SubjectRepository::class)]#[ORM\Table(name: 'hs_tc_tutoring_subject')]#[ApiResource]class Subject implements \Stringable{ use Actions; /** * @var string */ #[ORM\Column(name: 'name', type: 'string', length: 255)] private $name; #[ORM\OneToMany(mappedBy: 'subject', targetEntity: Course::class, cascade: ['persist'], orphanRemoval: true)] private ?Collection $courses = null; /** * @var string */ #[ORM\Column(name: 'image1_name', type: 'string', length: 255, nullable: true)] protected $image1Name; protected $image1File; public function __construct() { $this->createAt=new \DateTime('now'); $this->published=true; } /** * Get id * * @return integer */ public function getId() { return $this->id; } /** * Set nom * * @param string $name * @return Subject */ public function setName($name) { $this->name = $name; return $this; } /** * Get name * * @return string */ public function getName() { return $this->name; } function __toString(): string { return $this->name; } /** * Add rowscourse * * * @return Subject */ public function addCourse(Course $course) { $course->setSubject($this); $this->courses[] = $course; return $this; } /** * Remove course */ public function removeCourse(Course $course) { $this->courses->removeElement($course); } /** * Get courses * * @return \Doctrine\Common\Collections\Collection */ public function getCourses() { return $this->courses; } /** * @return string */ public function getImage1Name() { return $this->image1Name; } /** * @param string $image1Name * @return Subject */ public function setImage1Name($image1Name) { $this->image1Name = $image1Name; return $this; } /** * @return mixed */ public function getImage1File() { return $this->image1File; } /** * @param mixed $image1File * @return Subject */ public function setImage1File(UploadedFile $image1File=null) { $this->image1File = $image1File; return $this; }}