[feature/sql-bool-builder] Changing syntax

Changing the syntax used to the one Nicofuma suggested.

PHPBB3-13652
This commit is contained in:
brunoais 2015-10-24 14:36:41 +01:00
parent 6806c20bce
commit bb260f02e0

View file

@ -812,16 +812,16 @@ abstract class driver implements driver_interface
if ($operations_ary[0] !== 'AND' && if ($operations_ary[0] !== 'AND' &&
$operations_ary[0] !== 'OR') $operations_ary[0] !== 'OR')
{ {
$operations_ary = array('AND', $operations_ary); $operations_ary = array('AND', array($operations_ary));
} }
return $this->_process_boolean_tree($operations_ary) . "\n"; return $this->_process_boolean_tree($operations_ary) . "\n";
} }
protected function _process_boolean_tree($operations_ary) protected function _process_boolean_tree($operations_ary)
{ {
$operation = array_shift($operations_ary); $operation = $operations_ary[0];
foreach ($operations_ary as &$condition) foreach ($operations_ary[1] as &$condition)
{ {
switch ($condition[0]) switch ($condition[0])
{ {
@ -917,11 +917,11 @@ abstract class driver implements driver_interface
if ($operation === 'NOT') if ($operation === 'NOT')
{ {
$operations_ary = implode("", $operations_ary); $operations_ary = implode("", $operations_ary[1]);
} }
else else
{ {
$operations_ary = implode(" \n $operation ", $operations_ary); $operations_ary = implode(" \n $operation ", $operations_ary[1]);
} }
return $operations_ary; return $operations_ary;