From 9c624ebe22c0094c31783ca5ae71de0672e6a4e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Fri, 21 Jan 2022 14:29:21 +0100 Subject: [PATCH] join persistence is determined by joined model --- src/Model/Join.php | 12 ++---------- src/Persistence/Array_/Join.php | 3 --- src/Persistence/Sql/Join.php | 3 --- 3 files changed, 2 insertions(+), 16 deletions(-) diff --git a/src/Model/Join.php b/src/Model/Join.php index 5b1034bb8f..4f0b2c829d 100644 --- a/src/Model/Join.php +++ b/src/Model/Join.php @@ -37,14 +37,6 @@ abstract class Join */ protected $foreign_table; - /** - * If $persistence is set, then it's used for loading - * and storing the values, instead $owner->persistence. - * - * @var Persistence|Persistence\Sql|null - */ - protected $persistence; - /** * Field that is used as native "ID" in the foreign table. * When deleting record, this field will be conditioned. @@ -541,7 +533,7 @@ public function beforeInsert(Model $entity, array &$data): void $data[$this->master_field] = $this->getId($entity); } - // $entity->set($this->master_field, $this->getId($entity)); + // $entity->set($this->master_field, $this->getId($entity)); // TODO needed? from array persistence } public function afterInsert(Model $entity): void @@ -550,7 +542,7 @@ public function afterInsert(Model $entity): void return; } - $this->setSaveBufferValue($entity, $this->foreign_field, $this->hasJoin() ? $this->getJoin()->getId($entity) : $entity->getId()); // from array persistence... + $this->setSaveBufferValue($entity, $this->foreign_field, $this->hasJoin() ? $this->getJoin()->getId($entity) : $entity->getId()); // TODO needed? from array persistence $foreignModel = $this->getForeignModel(); $foreignEntity = $foreignModel->createEntity() diff --git a/src/Persistence/Array_/Join.php b/src/Persistence/Array_/Join.php index 6861303b90..517e82e0dd 100644 --- a/src/Persistence/Array_/Join.php +++ b/src/Persistence/Array_/Join.php @@ -8,9 +8,6 @@ use Atk4\Data\Model; use Atk4\Data\Persistence; -/** - * @property Persistence\Array_|null $persistence - */ class Join extends Model\Join { public function afterLoad(Model $entity): void diff --git a/src/Persistence/Sql/Join.php b/src/Persistence/Sql/Join.php index d41aecdd2b..787a1003c2 100644 --- a/src/Persistence/Sql/Join.php +++ b/src/Persistence/Sql/Join.php @@ -7,9 +7,6 @@ use Atk4\Data\Model; use Atk4\Data\Persistence; -/** - * @property Persistence\Sql $persistence - */ class Join extends Model\Join { /**