This repository has been archived on 2024-01-19. You can view files and clone it, but cannot push or open issues or pull requests.
epubreader/lib/Db/ReaderMapper.php

41 lines
930 B
PHP
Raw Normal View History

2020-04-21 20:37:42 +00:00
<?php
/**
* @author Frank de Lange
* @copyright 2017 Frank de Lange
*
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
namespace OCA\Epubreader\Db;
2020-04-21 20:37:42 +00:00
use OCP\IDBConnection;
use OCP\AppFramework\Db\Mapper;
use OCP\AppFramework\Db\Entity;
use OCA\Epubreader\Utility\Time;
2020-04-21 20:37:42 +00:00
abstract class ReaderMapper extends Mapper {
/**
* @var Time
*/
private $time;
public function __construct(IDBConnection $db, $table, $entity, Time $time) {
parent::__construct($db, $table, $entity);
$this->time = $time;
}
public function update(Entity $entity) {
$entity->setLastModified($this->time->getMicroTime());
return parent::update($entity);
}
public function insert(Entity $entity) {
$entity->setLastModified($this->time->getMicroTime());
return parent::insert($entity);
}
}