feat(bookstack) : add BookStackConfiguration entity and repository
This commit is contained in:
72
src/Entity/BookStackConfiguration.php
Normal file
72
src/Entity/BookStackConfiguration.php
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Entity;
|
||||||
|
|
||||||
|
use App\Repository\BookStackConfigurationRepository;
|
||||||
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
|
#[ORM\Entity(repositoryClass: BookStackConfigurationRepository::class)]
|
||||||
|
class BookStackConfiguration
|
||||||
|
{
|
||||||
|
#[ORM\Id]
|
||||||
|
#[ORM\GeneratedValue]
|
||||||
|
#[ORM\Column]
|
||||||
|
private ?int $id = null;
|
||||||
|
|
||||||
|
#[ORM\Column(length: 255, nullable: true)]
|
||||||
|
private ?string $url = null;
|
||||||
|
|
||||||
|
#[ORM\Column(type: 'text', nullable: true)]
|
||||||
|
private ?string $encryptedTokenId = null;
|
||||||
|
|
||||||
|
#[ORM\Column(type: 'text', nullable: true)]
|
||||||
|
private ?string $encryptedTokenSecret = null;
|
||||||
|
|
||||||
|
public function getId(): ?int
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getUrl(): ?string
|
||||||
|
{
|
||||||
|
return $this->url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setUrl(?string $url): static
|
||||||
|
{
|
||||||
|
$this->url = $url;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getEncryptedTokenId(): ?string
|
||||||
|
{
|
||||||
|
return $this->encryptedTokenId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setEncryptedTokenId(?string $encryptedTokenId): static
|
||||||
|
{
|
||||||
|
$this->encryptedTokenId = $encryptedTokenId;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getEncryptedTokenSecret(): ?string
|
||||||
|
{
|
||||||
|
return $this->encryptedTokenSecret;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setEncryptedTokenSecret(?string $encryptedTokenSecret): static
|
||||||
|
{
|
||||||
|
$this->encryptedTokenSecret = $encryptedTokenSecret;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function hasToken(): bool
|
||||||
|
{
|
||||||
|
return null !== $this->encryptedTokenId && null !== $this->encryptedTokenSecret;
|
||||||
|
}
|
||||||
|
}
|
||||||
22
src/Repository/BookStackConfigurationRepository.php
Normal file
22
src/Repository/BookStackConfigurationRepository.php
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Repository;
|
||||||
|
|
||||||
|
use App\Entity\BookStackConfiguration;
|
||||||
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||||
|
use Doctrine\Persistence\ManagerRegistry;
|
||||||
|
|
||||||
|
class BookStackConfigurationRepository extends ServiceEntityRepository
|
||||||
|
{
|
||||||
|
public function __construct(ManagerRegistry $registry)
|
||||||
|
{
|
||||||
|
parent::__construct($registry, BookStackConfiguration::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function findSingleton(): ?BookStackConfiguration
|
||||||
|
{
|
||||||
|
return $this->findOneBy([]);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user