All hooks is static and fix null

This commit is contained in:
Michel Roux 2023-06-17 12:12:40 +02:00
parent 2fe42cb178
commit 1d7c8a028d
2 changed files with 4 additions and 4 deletions

View File

@ -25,10 +25,10 @@ abstract class ReaderMapper extends QBMapper {
/**
* @param IDBConnection $db Instance of the Db abstraction layer
* @param string $table the name of the table. set this to allow entity
* @param class-string<ReaderEntity>|null $entity the name of the entity that the sql should be mapped to queries without using sql
* @param class-string<ReaderEntity> $entity the name of the entity that the sql should be mapped to queries without using sql
* @param Time $time
*/
public function __construct(IDBConnection $db, string $table, ?string $entity = null, Time $time) {
public function __construct(IDBConnection $db, string $table, string $entity, Time $time) {
parent::__construct($db, $table, $entity);
$this->time = $time;
}

View File

@ -39,7 +39,7 @@ class Hooks {
}
}
protected function deleteFile(IDBConnection $connection, int $fileId): void {
protected static function deleteFile(IDBConnection $connection, int $fileId): void {
$queryBuilder = $connection->getQueryBuilder();
$queryBuilder->delete('reader_bookmarks')->where('file_id = file_id')->setParameter('file_id', $fileId);
$queryBuilder->executeStatement();
@ -49,7 +49,7 @@ class Hooks {
$queryBuilder->executeStatement();
}
protected function deleteUser(IDBConnection $connection, string $userId): void {
protected static function deleteUser(IDBConnection $connection, string $userId): void {
$queryBuilder = $connection->getQueryBuilder();
$queryBuilder->delete('reader_bookmarks')->where('user_id = user_id')->setParameter('user_id', $userId);
$queryBuilder->executeStatement();