From e6770a5b083edb8c369922acccb8945327d98b3e Mon Sep 17 00:00:00 2001 From: nic0tin Date: Sat, 6 Jan 2024 10:59:07 +0100 Subject: [PATCH] [done]Query contains Associations --- src/Model/Repository/CakeRepository.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Model/Repository/CakeRepository.php b/src/Model/Repository/CakeRepository.php index b8a2d5d..d34031b 100644 --- a/src/Model/Repository/CakeRepository.php +++ b/src/Model/Repository/CakeRepository.php @@ -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() @@ -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(); } /**