From 7f05554f4e79391cce05cde35eaf4933e021427b Mon Sep 17 00:00:00 2001 From: Dave Smith-Hayes Date: Sun, 21 Jul 2024 21:33:34 -0400 Subject: [PATCH] Use long line strings for big queries and start the connection abstracts. --- .../Repository/Channel/ChannelRepository.php | 28 +++++++++++-------- .../Api/Database/ConnectionInterface.php | 8 ++++++ .../Api/Database/ConnectionPoolInterface.php | 11 ++++++++ docker-compose.yml | 2 +- 4 files changed, 37 insertions(+), 12 deletions(-) create mode 100644 app/src/Infrastructure/Api/Database/ConnectionInterface.php create mode 100644 app/src/Infrastructure/Api/Database/ConnectionPoolInterface.php diff --git a/app/src/Domain/Repository/Channel/ChannelRepository.php b/app/src/Domain/Repository/Channel/ChannelRepository.php index 1f06d86..c42859f 100644 --- a/app/src/Domain/Repository/Channel/ChannelRepository.php +++ b/app/src/Domain/Repository/Channel/ChannelRepository.php @@ -1,4 +1,4 @@ -db->query($query, [ $channel->getName(), @@ -120,13 +122,16 @@ class ChannelRepository implements ChannelRepositoryInterface */ public function update(Channel $channel): bool { - $query = "UPDATE channels SET name = ?, - slug = ?, - description = ?, - link = ?, - language = ?, - copyright = ?, - explicit = ?"; + $query = <<db->query($query, [ $channel->getName(), @@ -136,6 +141,7 @@ class ChannelRepository implements ChannelRepositoryInterface $channel->getLanguage(), $channel->getCopyright(), $channel->isExplicit(), + $channel->getId(), ])); return (bool) $results->affectedRows; diff --git a/app/src/Infrastructure/Api/Database/ConnectionInterface.php b/app/src/Infrastructure/Api/Database/ConnectionInterface.php new file mode 100644 index 0000000..0cc7599 --- /dev/null +++ b/app/src/Infrastructure/Api/Database/ConnectionInterface.php @@ -0,0 +1,8 @@ +