mirror of
https://github.com/ceratic/MediaCollectorLibary.git
synced 2026-05-13 23:56:46 +02:00
...
This commit is contained in:
@@ -15,39 +15,44 @@ class Source extends Model
|
||||
'last_sync_at'
|
||||
];
|
||||
|
||||
public function __construct(\PDO $pdo, array $data = [])
|
||||
{
|
||||
parent::__construct($pdo, $data);
|
||||
}
|
||||
|
||||
public function games(): array
|
||||
{
|
||||
$stmt = $this->pdo->prepare("SELECT * FROM games WHERE source_id = :source_id");
|
||||
$stmt->execute(['source_id' => $this->id]);
|
||||
return $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
return $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
public function movies(): array
|
||||
{
|
||||
$stmt = $this->pdo->prepare("SELECT * FROM movies WHERE source_id = :source_id");
|
||||
$stmt->execute(['source_id' => $this->id]);
|
||||
return $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
return $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
public function tvShows(): array
|
||||
{
|
||||
$stmt = $this->pdo->prepare("SELECT * FROM tv_shows WHERE source_id = :source_id");
|
||||
$stmt->execute(['source_id' => $this->id]);
|
||||
return $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
return $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
public function musicArtists(): array
|
||||
{
|
||||
$stmt = $this->pdo->prepare("SELECT * FROM music_artists WHERE source_id = :source_id");
|
||||
$stmt->execute(['source_id' => $this->id]);
|
||||
return $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
return $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
public function getSyncLogs(): array
|
||||
{
|
||||
$stmt = $this->pdo->prepare("SELECT * FROM sync_logs WHERE source_id = :source_id ORDER BY created_at DESC");
|
||||
$stmt->execute(['source_id' => $this->id]);
|
||||
return $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
return $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
public function createSyncLog(string $syncType, string $status): int
|
||||
|
||||
Reference in New Issue
Block a user