From e15cf6c87b13ef828d442c7591969f0cf960021e Mon Sep 17 00:00:00 2001 From: rafageist Date: Sun, 4 Aug 2019 19:25:29 -0400 Subject: [PATCH] fix data flow --- CHANGELOG.md | 4 ++++ README.md | 2 +- composer.json | 2 +- src/ways.php | 15 +++++++++------ 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1349737..6bdac8d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/README.md b/README.md index c0ae8d9..8c3d6c5 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/composer.json b/composer.json index 7952f6e..05b4aed 100644 --- a/composer.json +++ b/composer.json @@ -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": "*" diff --git a/src/ways.php b/src/ways.php index 1c56c64..8bbfba7 100644 --- a/src/ways.php +++ b/src/ways.php @@ -21,7 +21,7 @@ * * @package divengine/ways * @author Rafa Rodriguez [@rafageist] - * @version 2.3.2 + * @version 2.3.3 * * @link https://divengine.com * @link https://divengine.com/ways @@ -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; @@ -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()); } /** @@ -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); @@ -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(); } @@ -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(); @@ -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];