simplify GServer repository
This commit is contained in:
parent
38343ee417
commit
767ac778c9
1 changed files with 5 additions and 9 deletions
|
@ -11,22 +11,18 @@ use Friendica\Database\Database;
|
||||||
use Friendica\Federation\Entity\GServer as GServerEntity;
|
use Friendica\Federation\Entity\GServer as GServerEntity;
|
||||||
use Friendica\Federation\Factory\GServer as GServerFactory;
|
use Friendica\Federation\Factory\GServer as GServerFactory;
|
||||||
use Friendica\Network\HTTPException\NotFoundException;
|
use Friendica\Network\HTTPException\NotFoundException;
|
||||||
use Psr\Log\LoggerInterface;
|
|
||||||
|
|
||||||
final class GServer
|
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, GServerFactory $factory)
|
||||||
|
|
||||||
public function __construct(Database $database, LoggerInterface $logger, GServerFactory $factory)
|
|
||||||
{
|
{
|
||||||
$this->db = $database;
|
$this->db = $database;
|
||||||
$this->logger = $logger;
|
|
||||||
$this->factory = $factory;
|
$this->factory = $factory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +33,7 @@ final class GServer
|
||||||
*/
|
*/
|
||||||
public function selectOneById(int $gsid): GServerEntity
|
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)) {
|
if (!$this->db->isResult($fields)) {
|
||||||
throw new NotFoundException();
|
throw new NotFoundException();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue