Skip to content

armgit / Vvveb

Public Imported from GitHub
0

Powerful and easy to use cms to build websites, blogs or ecommerce stores.

Allow multiple level path variables for @result like @result.product.product_id

givanz136352b59376
diff --git a/system/sqlp/sqlp.php b/system/sqlp/sqlp.php
index 18902b5..4f85105 100755
--- a/system/sqlp/sqlp.php
+++ b/system/sqlp/sqlp.php
@@ -375,8 +375,7 @@ class Sqlp {
$lex = new Lexer($this->config['tokenMap'], $this->config['macroMap']);
$structure = $lex->lex($statement);
- //\Vvveb\d($structure);
- //die();
+
$output = $lex->treeMacro($structure);
$statement = $lex->treeToPhp($output, $this->config['macroMap']);
@@ -384,17 +383,14 @@ class Sqlp {
//replace result variables
$statement =
preg_replace_callback(
- '/@result.(\w+)/',
+ '/@result\.([\w\.]+)/',
function ($matches) {
- $key = $matches[1];
+ $key = \Vvveb\dotToArrayKey('$results.' . $matches[1]);
- return "' . (isset(\$results['$key']) ? \$results['$key'] : 'NULL') . '";
- //return "' . \$results['". $matches[1] . "'] . '";
+ return "' . (isset($key) ? $key : 'NULL') . '";
},
$statement);
- //$variable
-
//FILTER
if (preg_match_all($this->config['filterRegex'], $statement, $matches, PREG_SET_ORDER)) {
foreach ($matches as $match) {