mirror of
https://github.com/YGGverse/YGGtracker.git
synced 2026-03-31 17:15:38 +00:00
implement torrent sensitive edit features #11
This commit is contained in:
parent
cbda078c38
commit
b81d973331
7 changed files with 499 additions and 108 deletions
|
|
@ -141,7 +141,7 @@ class TorrentService
|
|||
{
|
||||
return $this->entityManagerInterface
|
||||
->getRepository(TorrentSensitive::class)
|
||||
->getTorrentLocales($id);
|
||||
->getTorrentSensitive($id);
|
||||
}
|
||||
|
||||
public function findLastTorrentSensitive(int $torrentId): ?TorrentSensitive
|
||||
|
|
@ -175,6 +175,22 @@ class TorrentService
|
|||
return $torrentLocales;
|
||||
}
|
||||
|
||||
public function toggleTorrentSensitiveApproved(
|
||||
int $id
|
||||
): ?TorrentSensitive
|
||||
{
|
||||
$torrentSensitive = $this->getTorrentSensitive($id);
|
||||
|
||||
$torrentSensitive->setApproved(
|
||||
!$torrentSensitive->isApproved() // toggle current value
|
||||
);
|
||||
|
||||
$this->entityManagerInterface->persist($torrentSensitive);
|
||||
$this->entityManagerInterface->flush();
|
||||
|
||||
return $torrentSensitive;
|
||||
}
|
||||
|
||||
// Delete
|
||||
public function deleteTorrentLocales(
|
||||
int $id
|
||||
|
|
@ -188,6 +204,18 @@ class TorrentService
|
|||
return $torrentLocales;
|
||||
}
|
||||
|
||||
public function deleteTorrentSensitive(
|
||||
int $id
|
||||
): ?TorrentSensitive
|
||||
{
|
||||
$torrentSensitive = $this->getTorrentSensitive($id);
|
||||
|
||||
$this->entityManagerInterface->remove($torrentSensitive);
|
||||
$this->entityManagerInterface->flush();
|
||||
|
||||
return $torrentSensitive;
|
||||
}
|
||||
|
||||
// Setters
|
||||
public function add(
|
||||
string $filepath,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue