From fe73457ff55cacee88588d15db28bc9fba9d52f3 Mon Sep 17 00:00:00 2001 From: Eduarda Lentz Rodrigues da Silva <e.lentzrodriguesdasilva@techdivision.com> Date: Mon, 20 Jan 2025 13:14:53 +0100 Subject: [PATCH] ZERO-162 Fix static test --- Api/CmsBlockRepositoryInterface.php | 2 +- Model/Query/GetCmsBlockByTitle.php | 2 +- Model/Repository/CmsBlockRepository.php | 10 +++------- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/Api/CmsBlockRepositoryInterface.php b/Api/CmsBlockRepositoryInterface.php index 0b0162f..66f10a0 100644 --- a/Api/CmsBlockRepositoryInterface.php +++ b/Api/CmsBlockRepositoryInterface.php @@ -27,4 +27,4 @@ interface CmsBlockRepositoryInterface * @return array */ public function getByTitle(string $title): array; -} \ No newline at end of file +} diff --git a/Model/Query/GetCmsBlockByTitle.php b/Model/Query/GetCmsBlockByTitle.php index 8b81467..d8584b2 100644 --- a/Model/Query/GetCmsBlockByTitle.php +++ b/Model/Query/GetCmsBlockByTitle.php @@ -50,4 +50,4 @@ class GetCmsBlockByTitle return $blockData; } -} \ No newline at end of file +} diff --git a/Model/Repository/CmsBlockRepository.php b/Model/Repository/CmsBlockRepository.php index 43111bc..8e94b5f 100644 --- a/Model/Repository/CmsBlockRepository.php +++ b/Model/Repository/CmsBlockRepository.php @@ -48,12 +48,8 @@ class CmsBlockRepository implements CmsBlockRepositoryInterface public function getByTitle(string $title): array { $connection = $this->resource->getConnection(); - $tableName = $this->resource->getTableName(self::CMS_BLOCK_TABLE_NAME); + $select = $connection->select()->from(self::CMS_BLOCK_TABLE_NAME)->where('title = :', $title); - $sqlQuery = "SELECT * FROM $tableName WHERE title = :title"; - $bind = ['title' => $title]; - - $result = $connection->fetchRow($sqlQuery, $bind); - return $result ?: []; + return $connection->fetchRow($select); } -} \ No newline at end of file +} -- GitLab