Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonkelly committed Dec 11, 2024
1 parent e3ffc4f commit 8caf78c
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/elements/db/ElementQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
}

Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -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();

Expand All @@ -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) {
Expand Down

0 comments on commit 8caf78c

Please sign in to comment.