Skip to content

Commit fefe26e

Browse files
authored
クエリの項目指定にテーブル名追加 (#4238)
1 parent c5b7f9c commit fefe26e

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

plugins/baser-core/src/Service/ContentsService.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,8 @@ public function setConditions(Query $query, array $queryParams): Query
272272

273273
// folder_id
274274
if (!is_null($params['folder_id']) && $params['folder_id']) {
275-
$folder = $this->Contents->find()->select(['lft', 'rght'])->where(['id' => $queryParams['folder_id']])->first();
275+
$folder = $this->Contents->find()->select(['lft', 'rght'])
276+
->where(['Contents.id' => $queryParams['folder_id']])->first();
276277
$conditions[] = ['Contents.rght <' => $folder->rght, 'Contents.lft >' => $folder->lft];
277278
}
278279

@@ -1216,7 +1217,11 @@ public function isMovable($currentId, $targetParentId)
12161217
}
12171218
// 移動先に同一コンテンツが存在するか確認
12181219
$movedContent = $this->Contents->find()
1219-
->where(['parent_id' => $parentId, 'name' => $currentContent->name, 'id !=' => $currentContent->id])
1220+
->where([
1221+
'Contents.parent_id' => $parentId,
1222+
'Contents.name' => $currentContent->name,
1223+
'Contents.id !=' => $currentContent->id
1224+
])
12201225
->first();
12211226
if ($movedContent) {
12221227
return false;
@@ -1460,7 +1465,7 @@ public function batch($method, array $ids): bool
14601465
*/
14611466
public function getTitlesById($ids): array
14621467
{
1463-
return $this->Contents->find('list')->select(['id', 'title'])->where(['id IN' => $ids])->toArray();
1468+
return $this->Contents->find('list')->select(['id', 'title'])->where(['Contents.id IN' => $ids])->toArray();
14641469
}
14651470

14661471
/**

0 commit comments

Comments
 (0)