Skip to content

Commit 0499357

Browse files
committed
Update to Dice 4.0
1 parent 52417ed commit 0499357

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

ModuleJson.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
<?php
22
namespace Level2\Router\Config;
33
class ModuleJson implements \Level2\Router\Rule {
4+
private $dice;
45
private $moduleDir;
56
private $configFile;
6-
private $moduleNames;
7-
private $jsonLoader;
87
private $request;
98

109
public function __construct(\Dice\Dice $dice, \Level2\Core\Request $request, $moduleDir = 'Modules', $configFile = 'manifest.json') {
@@ -76,7 +75,7 @@ private function mergeConfig($orig, $ext) {
7675

7776
private function getModel($settings, $name = '') {
7877
if (class_exists($settings['instanceOf'])) {
79-
$this->dice->addRule('$Model_' . $name, $settings);
78+
$this->dice = $this->dice->addRule('$Model_' . $name, $settings);
8079
$model = $this->dice->create('$Model_' . $name, [], []);
8180
}
8281
else {
@@ -86,7 +85,7 @@ private function getModel($settings, $name = '') {
8685
}
8786

8887
private function getRoute($routeSettings, $route) {
89-
$this->dice->addRule('$View', $routeSettings['view']);
88+
$this->dice = $this->dice->addRule('$View', $routeSettings['view']);
9089

9190
if (isset($routeSettings['model'])) {
9291
$model = $this->getModel($routeSettings['model']);
@@ -113,7 +112,7 @@ private function getRoute($routeSettings, $route) {
113112
$controllerRule['call'][] = [$action, $route, function ($return) use (&$model) {
114113
if (is_object($return)) $model = $return;
115114
}];
116-
$this->dice->addRule('$controller', $controllerRule);
115+
$this->dice = $this->dice->addRule('$controller', $controllerRule);
117116
if (is_array($model)) {
118117
$controller = $this->dice->create('$Controller', [], array_merge(array_values($model), [$this->request]));
119118
}

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
],
1313
"require": {
1414
"php": ">=5.5.0",
15-
"level-2/router" : "dev-master"
15+
"level-2/router" : "dev-master",
16+
"level-2/dice" : "^4.0"
1617
},
1718
"autoload": {
1819
"classmap": ["./"]

0 commit comments

Comments
 (0)