diff --git a/src/Database/Barry/Relations/BelongsTo.php b/src/Database/Barry/Relations/BelongsTo.php index 6e1ab70d..f48b71fe 100644 --- a/src/Database/Barry/Relations/BelongsTo.php +++ b/src/Database/Barry/Relations/BelongsTo.php @@ -52,7 +52,7 @@ public function __construct( public function getResults(): ?Model { $key = $this->query->getTable() . ":belongsto:" . $this->related->getTable() . ":" . $this->foreign_key; - $cache = Cache::cache('file')->get($key); + $cache = Cache::store('file')->get($key); if (!is_null($cache)) { $related = new $this->related(); @@ -63,7 +63,7 @@ public function getResults(): ?Model $result = $this->query->first(); if (!is_null($result)) { - Cache::cache('file')->add($key, $result->toArray(), 500); + Cache::store('file')->add($key, $result->toArray(), 500); } return $result; diff --git a/tests/Database/Relation/BelongsToRelationQueryTest.php b/tests/Database/Relation/BelongsToRelationQueryTest.php index d983bcb2..d17be65a 100644 --- a/tests/Database/Relation/BelongsToRelationQueryTest.php +++ b/tests/Database/Relation/BelongsToRelationQueryTest.php @@ -2,12 +2,13 @@ namespace Bow\Tests\Database\Relation; +use Bow\Cache\Cache; use Bow\Database\Database; use Bow\Database\Migration\SQLGenerator; use Bow\Tests\Config\TestingConfiguration; -use Bow\Tests\Database\Stubs\MigrationExtendedStub; -use Bow\Tests\Database\Stubs\PetMasterModelStub; use Bow\Tests\Database\Stubs\PetModelStub; +use Bow\Tests\Database\Stubs\PetMasterModelStub; +use Bow\Tests\Database\Stubs\MigrationExtendedStub; class BelongsToRelationQueryTest extends \PHPUnit\Framework\TestCase { @@ -15,6 +16,7 @@ public static function setUpBeforeClass(): void { $config = TestingConfiguration::getConfig(); Database::configure($config["database"]); + Cache::configure($config["cache"]); } public function connectionNames()