Skip to content

Commit

Permalink
fix data flow
Browse files Browse the repository at this point in the history
  • Loading branch information
rafageist committed Aug 4, 2019
1 parent d04c071 commit e15cf6c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Aug 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.2
# Div PHP Ways 2.3.3

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.2",
"version": "2.3.3",
"require": {
"php": ">=5.4.0",
"ext-json": "*"
Expand Down
15 changes: 9 additions & 6 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.2
* @version 2.3.3
*
* @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.2';
private static $__version = '2.3.3';

private static $__way_var;

Expand Down Expand Up @@ -278,7 +278,8 @@ public static function bootstrap($way_var = null, $default_way = null, &$output
$way = self::getCurrentWay($way_var, $default_way, $request_method);
self::$__executed = 0;

return self::callAll($way, $output, $show_output, $request_method, $default_way, [], self::getCurrentWayId());
$data = self::getCurrentData();
return self::callAll($way, $output, $show_output, $request_method, $default_way, $data, self::getCurrentWayId());
}

/**
Expand Down Expand Up @@ -483,6 +484,8 @@ public static function invoke($way, $data = [], &$output = '')
self::$__current_way = $way;
self::$__current_way_id = $way_id;

self::updateCurrentData($data, $way_id);

// call to all control points
$result = self::callAll($way, $output, true, null, '/', $data, $way_id);

Expand Down Expand Up @@ -985,7 +988,6 @@ private static function matchInternal($pattern, $way, &$args = [], $normalizeWay
*/
public static function match($pattern, $way = null, &$args = [])
{
//echo "MATCH $pattern - $way \n";
if ($way === null) {
$way = self::getCurrentWay();
}
Expand Down Expand Up @@ -1149,7 +1151,8 @@ public static function call($controller, $data = [], $args = [], &$output = '',
if (!$control['is_closure']) {
ob_start();
include_once $control['path'];
$data = self::getCurrentData(); // great fix!
$result = self::getCurrentData(); // great fix!
$data = self::cop($data, $result);
$include_output = ob_get_contents();
$output .= $include_output;
ob_end_clean();
Expand Down Expand Up @@ -1339,7 +1342,7 @@ public static function listen($pattern, $controller, $properties = [])
if ($pattern === '*') {
$way['methods'][0] = '*';
}
//print_r($way);

// $properties is the ID when is a string
if (is_string($properties)) {
$properties = [self::PROPERTY_ID => $properties];
Expand Down

0 comments on commit e15cf6c

Please sign in to comment.