nextcloud-gpodder/lib/Db/EpisodeAction/EpisodeActionEntity.php
Matthias Gutjahr 1d2056e025 Add check for EpisodeAction properties
- also add type hints and phpdocs
- add additional unit tests
- set integer types in EpisodeActionEntity
- correctly call static methods
- improve exception handling in EpisodeActionSaver
- remove unused method EpisodeActionWriter::purge()
2021-11-03 13:51:26 +01:00

45 lines
992 B
PHP

<?php
declare(strict_types=1);
namespace OCA\GPodderSync\Db\EpisodeAction;
use JsonSerializable;
use OCP\AppFramework\Db\Entity;
class EpisodeActionEntity extends Entity implements JsonSerializable {
protected $podcast;
protected $episode;
protected $action;
protected $position;
protected $started;
protected $total;
protected $timestamp;
protected $timestampEpoch;
protected $guid;
protected $userId;
public function __construct() {
$this->addType('id','integer');
$this->addType('started','integer');
$this->addType('position','integer');
$this->addType('total','integer');
$this->addType('timestampEpoch','integer');
}
public function jsonSerialize(): array {
return [
'id' => $this->id,
'podcast' => $this->podcast,
'episode' => $this->episode,
'guid' => $this->guid,
'action' => $this->action,
'position' => $this->position,
'started' => $this->started,
'total' => $this->total,
'timestamp' => $this->timestampEpoch,
];
}
}