memories/lib/Db/TimelineQuery.php

34 lines
851 B
PHP
Raw Normal View History

2022-08-20 02:53:21 +00:00
<?php
declare(strict_types=1);
namespace OCA\Memories\Db;
use OCP\IDBConnection;
class TimelineQuery {
2022-09-11 02:05:04 +00:00
use TimelineQueryDays;
2022-09-13 07:55:32 +00:00
use TimelineQueryFilters;
2022-09-11 02:05:04 +00:00
2022-09-09 07:31:42 +00:00
protected IDBConnection $connection;
2022-08-20 02:53:21 +00:00
2022-09-09 07:31:42 +00:00
public function __construct(IDBConnection $connection) {
$this->connection = $connection;
}
2022-09-25 13:21:40 +00:00
public function getInfoById(int $id): array {
$qb = $this->connection->getQueryBuilder();
$qb->select('*')
->from('memories')
->where($qb->expr()->eq('fileid', $qb->createNamedParameter($id, \PDO::PARAM_INT)));
$result = $qb->executeQuery();
$row = $result->fetch();
$result->closeCursor();
return [
'fileid' => intval($row['fileid']),
'dayid' => intval($row['dayid']),
'datetaken' => $row['datetaken'],
];
}
2022-08-20 02:53:21 +00:00
}