From 0e1e03ee93055116b06abe106ee6205cf6c3e2e4 Mon Sep 17 00:00:00 2001 From: Richard Date: Fri, 12 Apr 2019 11:15:32 -0400 Subject: [PATCH] Update to Dice 4.0 --- composer.json | 2 +- src/Json.php | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index ec1ef53..5e0230f 100644 --- a/composer.json +++ b/composer.json @@ -5,6 +5,6 @@ }, "require" : { "level-2/maphper" : "^0.9", - "level-2/dice" : "^3.0" + "level-2/dice" : "^4.0" } } diff --git a/src/Json.php b/src/Json.php index 04c53e2..923379c 100644 --- a/src/Json.php +++ b/src/Json.php @@ -31,7 +31,7 @@ public function addLoader($datasourceType, DataSource $datasource) { } private function addMaphper($name, $config, DataSource $datasource) { - $this->dice->addRule('$Maphper_Source_' . $name, $datasource->load($config)); + $this->dice = $this->dice->addRule('$Maphper_Source_' . $name, $datasource->load($config)); $mapper = [ 'instanceOf' => 'Maphper\\Maphper', 'substitutions' => ['Maphper\\DataSource' => [\Dice\Dice::INSTANCE => '$Maphper_Source_' . $name]], @@ -48,12 +48,12 @@ private function addMaphper($name, $config, DataSource $datasource) { if (isset($config['resultClass'])) $mapper['constructParams'] = [['resultClass' => function () use ($config) { return $this->dice->create($config['resultClass']); }]]; - $this->dice->addRule('$Maphper_' . $name, $mapper); + $this->dice = $this->dice->addRule('$Maphper_' . $name, $mapper); } private function addRelation($relationRuleName, $relation) { if ($relation['type'] === "ManyMany") { - $this->dice->addRule($relationRuleName, [ + $this->dice = $this->dice->addRule($relationRuleName, [ 'instanceOf' => 'Maphper\Relation\ManyMany', 'constructParams' => [ [\Dice\Dice::INSTANCE => '$Maphper_' . $relation['intermediate']], @@ -63,7 +63,7 @@ private function addRelation($relationRuleName, $relation) { ]); } else { - $this->dice->addRule($relationRuleName, [ + $this->dice = $this->dice->addRule($relationRuleName, [ 'instanceOf' => 'Maphper\Relation\\' . ucwords($relation['type']), 'constructParams' => [ [\Dice\Dice::INSTANCE => '$Maphper_' . $relation['to']],