From a3fd138b4dc793b3978b57ed53aa768f00e6c320 Mon Sep 17 00:00:00 2001 From: Sami Mokaddem Date: Fri, 9 Dec 2022 11:56:03 +0100 Subject: [PATCH] fix: [crud:edit] Always specify the table alias when fetching by id --- src/Controller/Component/CRUDComponent.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Controller/Component/CRUDComponent.php b/src/Controller/Component/CRUDComponent.php index f932e5a..8d2f08f 100644 --- a/src/Controller/Component/CRUDComponent.php +++ b/src/Controller/Component/CRUDComponent.php @@ -521,7 +521,7 @@ class CRUDComponent extends Component $params['contain'] = [$params['contain'], 'MetaFields']; } } - $query = $this->Table->find()->where(['id' => $id]); + $query = $this->Table->find()->where(["{$this->TableAlias}.id" => $id]); if (!empty($params['contain'])) { $query->contain($params['contain']); }