feat: movie download monitor

This commit is contained in:
2025-05-03 09:34:40 -05:00
parent 993b34d668
commit babcb00440
13 changed files with 552 additions and 3 deletions

View File

@@ -3,7 +3,7 @@
namespace App\User\Framework\Entity;
use Aimeos\Map;
use App\User\Framework\Repository\PreferencesRepository;
use App\Download\Framework\Entity\MovieMonitor;
use App\User\Framework\Repository\UserRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
@@ -40,9 +40,16 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
#[ORM\OneToMany(targetEntity: UserPreference::class, mappedBy: 'user', cascade: ['persist', 'remove'])]
private Collection $userPreferences;
/**
* @var Collection<int, MovieMonitor>
*/
#[ORM\OneToMany(targetEntity: MovieMonitor::class, mappedBy: 'user', orphanRemoval: true)]
private Collection $yes;
public function __construct()
{
$this->userPreferences = new ArrayCollection();
$this->yes = new ArrayCollection();
}
public function getId(): ?int
@@ -204,4 +211,34 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
})
->toArray();
}
/**
* @return Collection<int, MovieMonitor>
*/
public function getYes(): Collection
{
return $this->yes;
}
public function addYe(MovieMonitor $ye): static
{
if (!$this->yes->contains($ye)) {
$this->yes->add($ye);
$ye->setUser($this);
}
return $this;
}
public function removeYe(MovieMonitor $ye): static
{
if ($this->yes->removeElement($ye)) {
// set the owning side to null (unless already changed)
if ($ye->getUser() === $this) {
$ye->setUser(null);
}
}
return $this;
}
}