From 86a94def3963d4e0e92259b6fd598b63ec262f1f Mon Sep 17 00:00:00 2001 From: Franck DAKIA Date: Fri, 20 Mar 2026 11:49:15 +0000 Subject: [PATCH] Fix belongs to --- src/Database/Barry/Relations/BelongsTo.php | 2 +- src/Database/Barry/Relations/HasOne.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Database/Barry/Relations/BelongsTo.php b/src/Database/Barry/Relations/BelongsTo.php index 256c3d13..aa1cebd5 100644 --- a/src/Database/Barry/Relations/BelongsTo.php +++ b/src/Database/Barry/Relations/BelongsTo.php @@ -38,7 +38,7 @@ public function __construct( */ public function getResults(): mixed { - $key = $this->query->getTable() . ":belongsto:" . $this->related->getTable() . ":" . $this->foreign_key; + $key = $this->query->getTable() . ":" . $this->local_key . ":belongsto:" . $this->related->getTable() . ":" . $this->foreign_key; $cache = Cache::store('file')->get($key); diff --git a/src/Database/Barry/Relations/HasOne.php b/src/Database/Barry/Relations/HasOne.php index 2639b10e..cb47d921 100644 --- a/src/Database/Barry/Relations/HasOne.php +++ b/src/Database/Barry/Relations/HasOne.php @@ -33,7 +33,7 @@ public function __construct(Model $related, Model $parent, string $foreign_key, */ public function getResults(): ?Model { - $key = $this->query->getTable() . ":hasone:" . $this->related->getTable() . ":" . $this->foreign_key; + $key = $this->query->getTable() . ":" . $this->local_key . ":hasone:" . $this->related->getTable() . ":" . $this->foreign_key; $cache = Cache::store('file')->get($key);