src/Entity/UserSport.php line 12
<?phpnamespace App\Entity;use App\Repository\UserSportRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\DBAL\Types\Types;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity(repositoryClass: UserSportRepository::class)]class UserSport{#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]private ?int $id = null;#[ORM\Column(type: Types::DATE_MUTABLE)]private ?\DateTimeInterface $date_ajout = null;#[ORM\ManyToOne(inversedBy: 'userSport')]private ?User $user = null;#[ORM\ManyToMany(targetEntity: Sport::class, inversedBy: 'userSports')]private Collection $userSports;public function __construct(){$this->date_ajout = new \DateTimeImmutable();$this->userSports = new ArrayCollection();}public function getId(): ?int{return $this->id;}public function getDateAjout(): ?\DateTimeInterface{return $this->date_ajout;}public function setDateAjout(\DateTimeInterface $date_ajout): static{$this->date_ajout = $date_ajout;return $this;}public function getUser(): ?User{return $this->user;}public function setUser(?User $user): static{$this->user = $user;return $this;}/*** @return Collection<int, Sport>*/public function getUserSports(): Collection{return $this->userSports;}public function addUserSport(Sport $userSport): static{if (!$this->userSports->contains($userSport)) {$this->userSports->add($userSport);}return $this;}public function removeUserSport(Sport $userSport): static{$this->userSports->removeElement($userSport);return $this;}}