Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
catfan committed Dec 25, 2017
2 parents d65fad6 + 59c2f1a commit 1aa25a4
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions src/Medoo.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*!
* Medoo database framework
* https://medoo.in
* Version 1.5.2
* Version 1.5.3
*
* Copyright 2017, Angel Lai
* Released under the MIT license
Expand Down Expand Up @@ -521,19 +521,18 @@ protected function dataImplode($data, &$map, $conjunctor)
{
$type = gettype($value);

if ($type === 'array')
if (
$type === 'array' &&
preg_match("/^(AND|OR)(\s+#.*)?$/", $key, $relation_match)
)
{
$relationship = strpos($key, 'AND', 0) !== false ? 'AND' :
(strpos($key, 'OR', 0) !== false ? 'OR' : false);
$relationship = $relation_match[ 1 ];

if ($relationship)
{
$stack[] = !empty(array_diff_key($value, array_keys(array_keys($value)))) ?
'(' . $this->dataImplode($value, $map, ' ' . $relationship) . ')' :
'(' . $this->innerConjunct($value, $map, ' ' . $relationship, $conjunctor) . ')';
$stack[] = $value !== array_keys(array_keys($value)) ?
'(' . $this->dataImplode($value, $map, ' ' . $relationship) . ')' :
'(' . $this->innerConjunct($value, $map, ' ' . $relationship, $conjunctor) . ')';

continue;
}
continue;
}

$map_key = $this->mapKey();
Expand Down

0 comments on commit 1aa25a4

Please sign in to comment.