src/Entity/Instructor.php line 13
<?phpnamespace App\Entity;use App\Repository\InstructorRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\DBAL\Types\Types;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\Validator\Constraints as Assert;#[ORM\Entity(repositoryClass: InstructorRepository::class)]class Instructor{#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]private ?int $id = null;#[Assert\Length(min: 2,max: 255,minMessage: 'Le nom doit contenir au moins {{ limit }} caractères',maxMessage: 'Le nom ne peut pas dépasser {{ limit }} caractères',)]#[ORM\Column(length: 255)]private ?string $nom = null;#[Assert\Length(min: 2,max: 255,minMessage: 'Le prénom doit contenir au moins {{ limit }} caractères',maxMessage: 'Le prénom ne peut pas dépasser {{ limit }} caractères',)]#[ORM\Column(length: 255)]private ?string $prenom = null;#[Assert\Email(message: 'L\'email {{ value }} n\'est pas valide')]#[ORM\Column(length: 255, nullable: true)]private ?string $email = null;#[ORM\Column(type: Types::TEXT, nullable: true)]private ?string $bio = null;#[ORM\Column(length: 255, nullable: true)]private ?string $photo = null;#[ORM\Column(nullable: true)]private ?\DateTimeImmutable $createdAt = null;#[ORM\ManyToMany(targetEntity: Playlist::class, mappedBy: 'instructors')]private Collection $playlists;public function __construct(){$this->playlists = new ArrayCollection();$this->createdAt = new \DateTimeImmutable();}public function __toString(){return $this->prenom . ' ' . $this->nom;}public function getId(): ?int{return $this->id;}public function getNom(): ?string{return $this->nom;}public function setNom(string $nom): self{$this->nom = $nom;return $this;}public function getPrenom(): ?string{return $this->prenom;}public function setPrenom(string $prenom): self{$this->prenom = $prenom;return $this;}public function getEmail(): ?string{return $this->email;}public function setEmail(?string $email): self{$this->email = $email;return $this;}public function getBio(): ?string{return $this->bio;}public function setBio(?string $bio): self{$this->bio = $bio;return $this;}public function getPhoto(): ?string{return $this->photo;}public function setPhoto(?string $photo): self{$this->photo = $photo;return $this;}public function getCreatedAt(): ?\DateTimeImmutable{return $this->createdAt;}public function setCreatedAt(?\DateTimeImmutable $createdAt): self{$this->createdAt = $createdAt;return $this;}/*** @return Collection<int, Playlist>*/public function getPlaylists(): Collection{return $this->playlists;}public function addPlaylist(Playlist $playlist): self{if (!$this->playlists->contains($playlist)) {$this->playlists->add($playlist);$playlist->addInstructor($this);}return $this;}public function removePlaylist(Playlist $playlist): self{if ($this->playlists->removeElement($playlist)) {$playlist->removeInstructor($this);}return $this;}}