Skip to content

Commit 059bef4

Browse files
authored
fix NonUniqueFieldNameException
1 parent 90f5882 commit 059bef4

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/Controller/FilesController.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,14 @@ public function fileAction(Request $request, string $file): BinaryFileResponse
154154

155155
protected function findFirstPublishedRootByHostAndLanguage(string $host, string $language): ?PageModel
156156
{
157-
$columns = ["type='root' AND (dns=? OR dns='') AND (language=? OR fallback='1')"];
157+
$t = PageModel::getTable();
158+
$columns = ["$t.type='root' AND ($t.dns=? OR $t.dns='') AND ($t.language=? OR $t.fallback='1')"];
158159
$values = [$host, $language];
159-
$options = ['order' => 'dns DESC, fallback'];
160+
$options = ['order' => "$t.dns DESC, $t.fallback"];
160161

161162
if (!$this->tokenChecker->isPreviewMode()) {
162163
$time = Date::floorToMinute();
163-
$columns[] = "published='1' AND (start='' OR start<='$time') AND (stop='' OR stop>'$time')";
164+
$columns[] = "$t.published='1' AND ($t.start='' OR $t.start<='$time') AND ($t.stop='' OR $t.stop>'$time')";
164165
}
165166

166167
return PageModel::findOneBy($columns, $values, $options);

0 commit comments

Comments
 (0)