From 8caf78c31f905c31321a21793f62ca1c5f50adca Mon Sep 17 00:00:00 2001 From: brandonkelly Date: Wed, 11 Dec 2024 10:51:17 -0800 Subject: [PATCH] Cleanup --- src/elements/db/ElementQuery.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/elements/db/ElementQuery.php b/src/elements/db/ElementQuery.php index f47932383da..cb5f143060b 100644 --- a/src/elements/db/ElementQuery.php +++ b/src/elements/db/ElementQuery.php @@ -1543,14 +1543,12 @@ public function prepare($builder): Query ); } - $db = $builder->db; - if (!$db instanceof Connection) { + if (!$builder->db instanceof Connection) { throw new QueryAbortedException(sprintf('Element queries must be executed for %s connections.', Connection::class)); } // todo: remove after the next breakpoint - /** @var */ - if (!$db->columnExists(Table::ELEMENTS_SITES, 'content')) { + if (!$builder->db->columnExists(Table::ELEMENTS_SITES, 'content')) { throw new QueryAbortedException("The elements_sites.content column doesn't exist yet."); } @@ -1710,7 +1708,7 @@ public function prepare($builder): Query } // Map custom field handles to their content values - $isMysql = $db->getIsMysql(); + $isMysql = $builder->db->getIsMysql(); foreach ($this->customFields as $field) { $dbTypes = $field::dbType(); @@ -1752,7 +1750,7 @@ public function prepare($builder): Query $this->_applyRevisionParams(); $this->_applySearchParam(); $this->_applyInBulkOpParam(); - $this->_applyOrderByParams($db); + $this->_applyOrderByParams($builder->db); $this->_applySelectParam(); $this->_applyJoinParams(); @@ -1774,7 +1772,7 @@ public function prepare($builder): Query } } - $this->_applyUniqueParam($db); + $this->_applyUniqueParam($builder->db); // Pass along the cache info if ($this->queryCacheDuration !== null) {