feat: movie download monitor
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user