feat : add ZimbraConfiguration entity for CalDAV settings
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
104
src/Entity/ZimbraConfiguration.php
Normal file
104
src/Entity/ZimbraConfiguration.php
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Entity;
|
||||||
|
|
||||||
|
use App\Repository\ZimbraConfigurationRepository;
|
||||||
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
use Symfony\Component\Validator\Constraints as Assert;
|
||||||
|
|
||||||
|
#[ORM\Entity(repositoryClass: ZimbraConfigurationRepository::class)]
|
||||||
|
class ZimbraConfiguration
|
||||||
|
{
|
||||||
|
#[ORM\Id]
|
||||||
|
#[ORM\GeneratedValue]
|
||||||
|
#[ORM\Column]
|
||||||
|
private ?int $id = null;
|
||||||
|
|
||||||
|
#[ORM\Column(length: 255, nullable: true)]
|
||||||
|
#[Assert\Url]
|
||||||
|
private ?string $serverUrl = null;
|
||||||
|
|
||||||
|
#[ORM\Column(length: 255, nullable: true)]
|
||||||
|
private ?string $username = null;
|
||||||
|
|
||||||
|
#[ORM\Column(type: 'text', nullable: true)]
|
||||||
|
private ?string $encryptedPassword = null;
|
||||||
|
|
||||||
|
#[ORM\Column(length: 255, nullable: true)]
|
||||||
|
private ?string $calendarPath = null;
|
||||||
|
|
||||||
|
#[ORM\Column(type: 'boolean')]
|
||||||
|
private bool $enabled = false;
|
||||||
|
|
||||||
|
public function getId(): ?int
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getServerUrl(): ?string
|
||||||
|
{
|
||||||
|
return $this->serverUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setServerUrl(?string $serverUrl): static
|
||||||
|
{
|
||||||
|
$this->serverUrl = $serverUrl;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getUsername(): ?string
|
||||||
|
{
|
||||||
|
return $this->username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setUsername(?string $username): static
|
||||||
|
{
|
||||||
|
$this->username = $username;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getEncryptedPassword(): ?string
|
||||||
|
{
|
||||||
|
return $this->encryptedPassword;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setEncryptedPassword(?string $encryptedPassword): static
|
||||||
|
{
|
||||||
|
$this->encryptedPassword = $encryptedPassword;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCalendarPath(): ?string
|
||||||
|
{
|
||||||
|
return $this->calendarPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setCalendarPath(?string $calendarPath): static
|
||||||
|
{
|
||||||
|
$this->calendarPath = $calendarPath;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isEnabled(): bool
|
||||||
|
{
|
||||||
|
return $this->enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setEnabled(bool $enabled): static
|
||||||
|
{
|
||||||
|
$this->enabled = $enabled;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function hasPassword(): bool
|
||||||
|
{
|
||||||
|
return null !== $this->encryptedPassword;
|
||||||
|
}
|
||||||
|
}
|
||||||
26
src/Repository/ZimbraConfigurationRepository.php
Normal file
26
src/Repository/ZimbraConfigurationRepository.php
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Repository;
|
||||||
|
|
||||||
|
use App\Entity\ZimbraConfiguration;
|
||||||
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||||
|
use Doctrine\Persistence\ManagerRegistry;
|
||||||
|
|
||||||
|
class ZimbraConfigurationRepository extends ServiceEntityRepository
|
||||||
|
{
|
||||||
|
public function __construct(ManagerRegistry $registry)
|
||||||
|
{
|
||||||
|
parent::__construct($registry, ZimbraConfiguration::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function findSingleton(): ?ZimbraConfiguration
|
||||||
|
{
|
||||||
|
return $this->createQueryBuilder('z')
|
||||||
|
->setMaxResults(1)
|
||||||
|
->getQuery()
|
||||||
|
->getOneOrNullResult()
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user