Skip to content

Commit

Permalink
fix rules for default action Run
Browse files Browse the repository at this point in the history
  • Loading branch information
rafageist committed Aug 24, 2019
1 parent e15cf6c commit 4a1a569
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
Aug 23, 2019
Aug 24, 2019
-------------------
- `fix`: rules for default action Run
- `release`: version 2.3.4

Jul 23, 2019
-------------------
- `fix`: fix flow of the data before bootstrap and invoke
- `release`: version 2.3.3

Jul 23, 2019
-------------------
- `fix`: bug fix in rules
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Div PHP Ways 2.3.3
# Div PHP Ways 2.3.4

A "way" is different to a "route". We need a path for found
a specific resource, but we need a way for do something.
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"controllers"
],
"homepage": "https://divengine.com/ways",
"version": "2.3.3",
"version": "2.3.4",
"require": {
"php": ">=5.4.0",
"ext-json": "*"
Expand Down
17 changes: 12 additions & 5 deletions src/ways.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*
* @package divengine/ways
* @author Rafa Rodriguez [@rafageist] <[email protected]>
* @version 2.3.3
* @version 2.3.4
*
* @link https://divengine.com
* @link https://divengine.com/ways
Expand Down Expand Up @@ -57,7 +57,7 @@ class ways

const PROPERTY_RULES = 'rules';

private static $__version = '2.3.3';
private static $__version = '2.3.4';

private static $__way_var;

Expand Down Expand Up @@ -1091,9 +1091,12 @@ public static function call($controller, $data = [], $args = [], &$output = '',
$method = "{$controller}@{$action}";
if (isset($rules[$method])) {
$rules = $rules[$method];
if (is_string($rules)) {
$rules = [$rules];
}
} elseif (isset($rules[$action])) {
$rules = $rules[$action];
}

if (is_string($rules)) {
$rules = [$rules];
}

foreach ($rules as $rule) {
Expand Down Expand Up @@ -1469,9 +1472,13 @@ public static function register($path, $properties = [])
if (!is_array($rules)) {
$rules = [$rules];
}

foreach ($rules as $rule) {
if (!is_array(self::$__controllers[$prop[self::PROPERTY_ID]]['prop'][self::PROPERTY_RULES]))
self::$__controllers[$prop[self::PROPERTY_ID]]['prop'][self::PROPERTY_RULES] = [];
self::$__controllers[$prop[self::PROPERTY_ID]]['prop'][self::PROPERTY_RULES]['Run'][] = $rule;
}

}


Expand Down

0 comments on commit 4a1a569

Please sign in to comment.