File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -483,7 +483,8 @@ protected function beforePrepare(): bool
483483 $ sortOrderIndex = Db::findIndex (CraftTable::ELEMENTS_OWNERS , ['sortOrder ' ], false );
484484 // Forcing the use of the `sortOrder` index if no custom `orderBy` is set
485485 if ($ sortOrderIndex !== null && empty ($ this ->orderBy )) {
486- $ this ->subQuery ->innerJoin ([new Expression ('[[elements_owners]] USE INDEX ( ' . $ sortOrderIndex . ') ' )], $ ownersCondition );
486+ $ elementOwnersTable = Craft::$ app ->getDb ()->schema ->getRawTableName (\craft \db \Table::ELEMENTS_OWNERS );
487+ $ this ->subQuery ->innerJoin ([new Expression ('[[ ' .$ elementOwnersTable .']] AS elements_owners USE INDEX ( ' . $ sortOrderIndex . ') ' )], $ ownersCondition );
487488 } else {
488489 $ this ->subQuery ->innerJoin (['elements_owners ' => CraftTable::ELEMENTS_OWNERS ], $ ownersCondition );
489490 }
You can’t perform that action at this time.
0 commit comments