<?php
namespace App\Entity;
use App\Repository\CoachInfoRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: CoachInfoRepository::class)]
class CoachInfo
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\Column(type: 'string', length: 255)]
private $name;
#[ORM\OneToOne(targetEntity: Coach::class, inversedBy: 'coachInfo', cascade: ['persist', 'remove'])]
private $owner;
#[ORM\OneToMany(targetEntity: Formation::class, mappedBy: 'coach')]
private $formation;
#[ORM\OneToMany(targetEntity: Experience::class, mappedBy: 'coach')]
private $experience;
#[ORM\Column(type: 'text', nullable: true)]
private $description;
#[ORM\OneToOne(targetEntity: Address::class, cascade: ['persist', 'remove'])]
private $address;
#[ORM\ManyToMany(targetEntity: Course::class, mappedBy: 'coachsInfos')]
private $courses;
#[ORM\Column(type: 'datetime_immutable', nullable: true, options: ['default' => 'CURRENT_TIMESTAMP'])]
private $createdAt;
#[ORM\Column(length: 255, nullable: true)]
private ?string $image = null;
#[ORM\ManyToOne(targetEntity: Club::class, inversedBy: 'createdCoachInfos')]
#[ORM\JoinColumn(nullable: true)]
private ?Club $createdByClub = null;
#[ORM\ManyToOne(targetEntity: Operator::class, inversedBy: 'createdCoachInfos')]
#[ORM\JoinColumn(nullable: true)]
private ?Operator $createdByOperator = null;
public function __construct()
{
$this->formation = new ArrayCollection();
$this->experience = new ArrayCollection();
$this->courses = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getOwner(): ?Coach
{
return $this->owner;
}
public function setOwner(?Coach $owner): self
{
$this->owner = $owner;
return $this;
}
/**
* @return Collection|Formation[]
*/
public function getFormation(): Collection
{
return $this->formation;
}
public function addFormation(Formation $formation): self
{
if (!$this->formation->contains($formation)) {
$this->formation[] = $formation;
$formation->setCoach($this);
}
return $this;
}
public function removeFormation(Formation $formation): self
{
if ($this->formation->removeElement($formation)) {
// set the owning side to null (unless already changed)
if ($formation->getCoach() === $this) {
$formation->setCoach(null);
}
}
return $this;
}
/**
* @return Collection|Experience[]
*/
public function getExperience(): Collection
{
return $this->experience;
}
public function addExperience(Experience $experience): self
{
if (!$this->experience->contains($experience)) {
$this->experience[] = $experience;
$experience->setCoach($this);
}
return $this;
}
public function removeExperience(Experience $experience): self
{
if ($this->experience->removeElement($experience)) {
// set the owning side to null (unless already changed)
if ($experience->getCoach() === $this) {
$experience->setCoach(null);
}
}
return $this;
}
public function getDescription()
{
return $this->description;
}
public function setDescription($description)
{
$this->description = $description;
return $this;
}
public function getAddress(): ?Address
{
return $this->address;
}
public function setAddress(?Address $address): self
{
$this->address = $address;
return $this;
}
/**
* @return Collection<int, Course>
*/
public function getCourses(): Collection
{
return $this->courses;
}
public function addCourse(Course $course): self
{
if (!$this->courses->contains($course)) {
$this->courses[] = $course;
$course->addCoachsInfo($this);
}
return $this;
}
public function removeCourse(Course $course): self
{
if ($this->courses->removeElement($course)) {
$course->removeCoachsInfo($this);
}
return $this;
}
public function getCreatedAt(): ?\DateTimeImmutable
{
return $this->createdAt;
}
public function setCreatedAt(?\DateTimeImmutable $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getImage(): ?string
{
return $this->image;
}
public function setImage(?string $image): static
{
$this->image = $image;
return $this;
}
public function getCreatedByClub(): ?Club
{
return $this->createdByClub;
}
public function setCreatedByClub(?Club $createdByClub): self
{
$this->createdByClub = $createdByClub;
return $this;
}
public function getCreatedByOperator(): ?Operator
{
return $this->createdByOperator;
}
public function setCreatedByOperator(?Operator $createdByOperator): self
{
$this->createdByOperator = $createdByOperator;
return $this;
}
}