feat: add UserMovie join entity

This commit is contained in:
thibaud-leclere
2026-03-29 10:10:27 +02:00
parent 5d16d28c59
commit 5f7ddcd3cc
3 changed files with 113 additions and 0 deletions

55
src/Entity/UserMovie.php Normal file
View File

@@ -0,0 +1,55 @@
<?php
declare(strict_types=1);
namespace App\Entity;
use App\Repository\UserMovieRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: UserMovieRepository::class)]
#[ORM\UniqueConstraint(name: 'user_movie_unique', columns: ['user_id', 'movie_id'])]
class UserMovie
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\ManyToOne(targetEntity: User::class)]
#[ORM\JoinColumn(nullable: false)]
private ?User $user = null;
#[ORM\ManyToOne(targetEntity: Movie::class)]
#[ORM\JoinColumn(nullable: false)]
private ?Movie $movie = null;
public function getId(): ?int
{
return $this->id;
}
public function getUser(): ?User
{
return $this->user;
}
public function setUser(?User $user): static
{
$this->user = $user;
return $this;
}
public function getMovie(): ?Movie
{
return $this->movie;
}
public function setMovie(?Movie $movie): static
{
$this->movie = $movie;
return $this;
}
}