Skip to content

Commit

Permalink
Fixed SQL error
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonkelly committed Feb 7, 2024
1 parent c1550a2 commit d6277fa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release Notes for CKEditor for Craft CMS

## 4.0.0-beta.2 - 2024-02-07

- Fixed a SQL error that occurred when creating a nested entry on PostgreSQL.

## 4.0.0-beta.1 - 2024-02-06

- CKEditor now requires Craft CMS 5.0.0-beta.1 or later.
Expand Down
4 changes: 2 additions & 2 deletions src/Field.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use craft\ckeditor\events\ModifyConfigEvent;
use craft\ckeditor\web\assets\BaseCkeditorPackageAsset;
use craft\ckeditor\web\assets\ckeditor\CkeditorAsset;
use craft\db\FixedOrderExpression;
use craft\db\Query;
use craft\db\Table;
use craft\elements\Asset;
Expand Down Expand Up @@ -54,7 +55,6 @@
use yii\base\InvalidArgumentException;
use yii\base\InvalidConfigException;
use yii\db\Exception;
use yii\db\Expression;

/**
* CKEditor field type
Expand Down Expand Up @@ -956,7 +956,7 @@ private function _entryManagerValueGetter(): Closure
$query = $this->createEntryQuery($owner);
$query->where(['in', 'elements.id', $entryIds]);
if (!empty($entryIds)) {
$query->orderBy(new Expression('FIELD (elements.id, ' . implode(', ', $entryIds) . ')'));
$query->orderBy(new FixedOrderExpression('elements.id', $entryIds, Craft::$app->getDb()));
}

return $query;
Expand Down

0 comments on commit d6277fa

Please sign in to comment.