nextcloud-gpodder/lib/Db/EpisodeAction/EpisodeActionWriter.php

34 lines
837 B
PHP
Raw Normal View History

<?php
declare(strict_types=1);
namespace OCA\GPodderSync\Db\EpisodeAction;
use Doctrine\DBAL\Exception\UniqueConstraintViolationException;
class EpisodeActionWriter {
/**
* @var EpisodeActionMapper
*/
private EpisodeActionMapper $episodeActionMapper;
public function __construct(EpisodeActionMapper $episodeActionMapper) {
$this->episodeActionMapper = $episodeActionMapper;
}
public function save(EpisodeActionEntity $episodeActionEntity): EpisodeActionEntity {
return $this->episodeActionMapper->insert($episodeActionEntity);
}
public function update(EpisodeActionEntity $episodeActionEntity) {
return $this->episodeActionMapper->update($episodeActionEntity);
}
public function purge() {
foreach ($this->episodeActionMapper->findAll() as $entity) {
$this->episodeActionMapper->delete($entity);
}
}
}