Skip to content

Commit

Permalink
join persistence is determined by joined model
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Jan 21, 2022
1 parent 0d38d46 commit 9c624eb
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 16 deletions.
12 changes: 2 additions & 10 deletions src/Model/Join.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand All @@ -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()
Expand Down
3 changes: 0 additions & 3 deletions src/Persistence/Array_/Join.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions src/Persistence/Sql/Join.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
use Atk4\Data\Model;
use Atk4\Data\Persistence;

/**
* @property Persistence\Sql $persistence
*/
class Join extends Model\Join
{
/**
Expand Down

0 comments on commit 9c624eb

Please sign in to comment.