added logger
This commit is contained in:
parent
9840fb50ff
commit
023a7e3668
|
@ -13,12 +13,11 @@ use PDOException;
|
||||||
*/
|
*/
|
||||||
class DynDNSRepository
|
class DynDNSRepository
|
||||||
{
|
{
|
||||||
public function __construct(private DatabaseConnection $databaseConnection, private array $config, private Logger $log)
|
public function __construct(
|
||||||
|
private readonly DatabaseConnection $databaseConnection,
|
||||||
|
private readonly Logger $logger)
|
||||||
{
|
{
|
||||||
if ($this->config['debug']) {
|
$this->logger->debug(message: "DynDNSRepository::__construct()");
|
||||||
$this->log->debug(message: "DynDNSRepository::__construct()");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -29,9 +28,7 @@ class DynDNSRepository
|
||||||
public function delete(DynDNS $dynDNS): int
|
public function delete(DynDNS $dynDNS): int
|
||||||
{
|
{
|
||||||
$dynDNSName = $dynDNS->getName();
|
$dynDNSName = $dynDNS->getName();
|
||||||
if ($this->config['debug']) {
|
$this->logger->debug(message: "delete($dynDNSName)");
|
||||||
$this->log->debug(message: "delete($dynDNSName)");
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = "
|
$sql = "
|
||||||
DELETE FROM " . DatabaseConnection::TABLE_DYNDNS . "
|
DELETE FROM " . DatabaseConnection::TABLE_DYNDNS . "
|
||||||
|
@ -54,9 +51,7 @@ class DynDNSRepository
|
||||||
*/
|
*/
|
||||||
public function findAll(): array
|
public function findAll(): array
|
||||||
{
|
{
|
||||||
if ($this->config['debug']) {
|
$this->logger->debug(message: "findAll()");
|
||||||
$this->log->debug(message: "findAll()");
|
|
||||||
}
|
|
||||||
|
|
||||||
$dyndns = [];
|
$dyndns = [];
|
||||||
$sql = "
|
$sql = "
|
||||||
|
@ -84,9 +79,8 @@ class DynDNSRepository
|
||||||
*/
|
*/
|
||||||
public function findByName(string $name): DynDNS|bool
|
public function findByName(string $name): DynDNS|bool
|
||||||
{
|
{
|
||||||
if ($this->config['debug']) {
|
$this->logger->debug(message: "findByName($name)");
|
||||||
$this->log->debug(message: "findByName($name)");
|
|
||||||
}
|
|
||||||
$sql = "
|
$sql = "
|
||||||
SELECT id, name, a, aaaa
|
SELECT id, name, a, aaaa
|
||||||
FROM " . DatabaseConnection::TABLE_DYNDNS . "
|
FROM " . DatabaseConnection::TABLE_DYNDNS . "
|
||||||
|
@ -134,9 +128,7 @@ class DynDNSRepository
|
||||||
public function insert(DynDNS $dynDNS): bool|string
|
public function insert(DynDNS $dynDNS): bool|string
|
||||||
{
|
{
|
||||||
$dynDNSName = $dynDNS->getName();
|
$dynDNSName = $dynDNS->getName();
|
||||||
if ($this->config['debug']) {
|
$this->logger->debug(message: "insert($dynDNSName)");
|
||||||
$this->log->debug(message: "insert($dynDNSName)");
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = "
|
$sql = "
|
||||||
INSERT INTO " . DatabaseConnection::TABLE_DYNDNS . " (name, a, aaaa)
|
INSERT INTO " . DatabaseConnection::TABLE_DYNDNS . " (name, a, aaaa)
|
||||||
|
@ -167,9 +159,7 @@ class DynDNSRepository
|
||||||
{
|
{
|
||||||
$dynDNSnName = $dynDNS->getName();
|
$dynDNSnName = $dynDNS->getName();
|
||||||
|
|
||||||
if ($this->config['debug']) {
|
$this->logger->debug(message: "update($dynDNSnName)");
|
||||||
$this->log->debug(message: "update($dynDNSnName)");
|
|
||||||
}
|
|
||||||
|
|
||||||
$id = $dynDNS->getId();
|
$id = $dynDNS->getId();
|
||||||
$current = $this->findByID(id: $id);
|
$current = $this->findByID(id: $id);
|
||||||
|
@ -220,9 +210,7 @@ class DynDNSRepository
|
||||||
*/
|
*/
|
||||||
public function findByID(int $id): bool|DynDNS
|
public function findByID(int $id): bool|DynDNS
|
||||||
{
|
{
|
||||||
if ($this->config['debug']) {
|
$this->logger->debug(message: "findById($id)");
|
||||||
$this->log->debug(message: "findById($id)");
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = "
|
$sql = "
|
||||||
SELECT id, name, a, aaaa
|
SELECT id, name, a, aaaa
|
||||||
|
|
Loading…
Reference in New Issue