Files
Alexandre Alapetite 5f6ef05ffc Fix bigint timestamps on 32-bit (#7375)
* Fix bigint timestamps on 32-bit
fix https://github.com/FreshRSS/FreshRSS/issues/7374
SQL requests for BIGINT fields may return a string on 32-bit systems instead of an integer

* Calculations may also be string
2025-02-26 17:01:25 +01:00

57 lines
1.2 KiB
PHP

<?php
declare(strict_types=1);
class FreshRSS_Tag extends Minz_Model {
use FreshRSS_AttributesTrait, FreshRSS_FilterActionsTrait;
private int $id = 0;
private string $name;
private int $nbEntries = -1;
private int $nbUnread = -1;
public function __construct(string $name = '') {
$this->_name($name);
}
public function id(): int {
return $this->id;
}
public function _id(int $value): void {
$this->id = $value;
}
public function name(): string {
return $this->name;
}
public function _name(string $value): void {
$this->name = trim($value);
}
public function nbEntries(): int {
if ($this->nbEntries < 0) {
$tagDAO = FreshRSS_Factory::createTagDao();
$this->nbEntries = $tagDAO->countEntries($this->id()) ?: 0;
}
return $this->nbEntries;
}
public function _nbEntries(int $value): void {
$this->nbEntries = $value;
}
public function nbUnread(): int {
if ($this->nbUnread < 0) {
$tagDAO = FreshRSS_Factory::createTagDao();
$this->nbUnread = $tagDAO->countNotRead($this->id()) ?: 0;
}
return $this->nbUnread;
}
/** @param int|numeric-string $value */
public function _nbUnread(int|string $value): void {
$this->nbUnread = (int)$value;
}
}