simplify GServer repository

This commit is contained in:
Art4 2025-03-07 13:49:22 +00:00
parent 38343ee417
commit 767ac778c9

View file

@ -11,22 +11,18 @@ use Friendica\Database\Database;
use Friendica\Federation\Entity\GServer as GServerEntity;
use Friendica\Federation\Factory\GServer as GServerFactory;
use Friendica\Network\HTTPException\NotFoundException;
use Psr\Log\LoggerInterface;
final class GServer
{
protected static $table_name = 'gserver';
private string $table_name = 'gserver';
protected Database $db;
private Database $db;
protected LoggerInterface $logger;
private GServerFactory $factory;
protected GServerFactory $factory;
public function __construct(Database $database, LoggerInterface $logger, GServerFactory $factory)
public function __construct(Database $database, GServerFactory $factory)
{
$this->db = $database;
$this->logger = $logger;
$this->factory = $factory;
}
@ -37,7 +33,7 @@ final class GServer
*/
public function selectOneById(int $gsid): GServerEntity
{
$fields = $this->db->selectFirst(static::$table_name, [], ['id' => $gsid], []);
$fields = $this->db->selectFirst($this->table_name, [], ['id' => $gsid], []);
if (!$this->db->isResult($fields)) {
throw new NotFoundException();