Skip to content

Commit

Permalink
[done]Query contains Associations
Browse files Browse the repository at this point in the history
  • Loading branch information
Nic0tiN committed Jan 6, 2024
1 parent 1122c02 commit e6770a5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Model/Repository/CakeRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ protected function query(): SelectQuery
{
return clone $this
->queryBuilder
->contain($this->table->associations()->keys())
->formatResults(
fn (ResultSet $results) => array_map(
[$this, 'convertDomain'], $results->toArray()
Expand Down Expand Up @@ -152,7 +153,7 @@ public function persist(mixed $entity, ?bool $new = null): object

$model->setNew($isNew);

return $this->table->save($model)->toDomain();
return $this->table->save($model, ['associated' => $this->table->associations()->keys()])->toDomain();
}

/**
Expand Down

0 comments on commit e6770a5

Please sign in to comment.