Skip to content

Commit

Permalink
Fixed #3663
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonkelly committed Jan 18, 2019
1 parent 3d19c37 commit 668f819
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-v3.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

### Fixed
- Fixed a PHP notice that occurred when updating to Craft 3.1 if there were any plugins installed without settings.
- Fixed a SQL error that occurred when updating to Craft 3.1 if a plugin or module was calling any `craft\services\Fields` methods. ([#3663](https://github.com/craftcms/cms/issues/3663))
- Fixed a bug where commercial plugins weren’t installable from the Plugin Store.
- Fixed a bug where Matrix block type fields’ `beforeSave()` methods weren’t getting called.
- Fixed a bug where Matrix fields could forget their content table name if they were created with a non-global context.
Expand Down
11 changes: 9 additions & 2 deletions src/services/Fields.php
Original file line number Diff line number Diff line change
Expand Up @@ -1553,7 +1553,7 @@ private function _createGroupQuery(): Query
*/
private function _createFieldQuery(): Query
{
return (new Query())
$query = (new Query())
->select([
'fields.id',
'fields.dateCreated',
Expand All @@ -1563,7 +1563,6 @@ private function _createFieldQuery(): Query
'fields.handle',
'fields.context',
'fields.instructions',
'fields.searchable',
'fields.translationMethod',
'fields.translationKeyFormat',
'fields.type',
Expand All @@ -1572,6 +1571,14 @@ private function _createFieldQuery(): Query
])
->from(['{{%fields}} fields'])
->orderBy(['fields.name' => SORT_ASC, 'fields.handle' => SORT_ASC]);

// todo: remove schema version condition after next beakpoint
$schemaVersion = Craft::$app->getProjectConfig()->get('system.schemaVersion');
if (version_compare($schemaVersion, '3.1.0', '>=')) {
$query->addSelect(['fields.searchable']);
}

return $query;
}

/**
Expand Down

0 comments on commit 668f819

Please sign in to comment.