make retrievel episode actions without guid more explanatory

This commit is contained in:
thrillfall 2021-08-25 20:25:08 +02:00
parent 9f0c06e919
commit 3a3038711f

View File

@ -84,17 +84,30 @@ class EpisodeActionSaver
);
if ($episodeActionEntityToUpdate === null && $episodeActionEntity->getGuid() !== null) {
$episodeActionEntityToUpdate = $this->episodeActionRepository->findByEpisodeIdentifier(
$episodeActionEntity->getEpisode(),
$userId
$episodeActionEntityToUpdate = $this->getOldEpisodeActionByEpisodeUrl(
$episodeActionEntity->getEpisode(), $userId
);
}
$idEpisodeActionEntityToUpdate = $episodeActionEntityToUpdate->getId();
$episodeActionEntity->setId($idEpisodeActionEntityToUpdate);
$episodeActionEntity->setId($episodeActionEntityToUpdate->getId());
return $this->episodeActionWriter->update($episodeActionEntity);
}
/**
* @param string $episodeUrl
* @param string $userId
*
* @return EpisodeActionEntity|null
*/
private function getOldEpisodeActionByEpisodeUrl(string $episodeUrl, string $userId): ?EpisodeActionEntity
{
return $this->episodeActionRepository->findByEpisodeIdentifier(
$episodeUrl,
$userId
);
}
/**
* @param EpisodeAction $episodeAction
* @param string $userId