Skip to content

Commit

Permalink
Update to Dice 4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
solleer committed Apr 12, 2019
1 parent cbdea59 commit 0e1e03e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
},
"require" : {
"level-2/maphper" : "^0.9",
"level-2/dice" : "^3.0"
"level-2/dice" : "^4.0"
}
}
8 changes: 4 additions & 4 deletions src/Json.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]],
Expand All @@ -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']],
Expand All @@ -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']],
Expand Down

0 comments on commit 0e1e03e

Please sign in to comment.