mirror of
https://github.com/dg/dibi.git
synced 2025-08-06 14:16:39 +02:00
DibiFluent: implemented clause auto-switch for 'JOIN', 'INNER JOIN', 'LEFT JOIN'
This commit is contained in:
@@ -72,6 +72,14 @@ class DibiFluent extends DibiObject implements IDataSource
|
|||||||
'INTO' => FALSE,
|
'INTO' => FALSE,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/** @var array clauses */
|
||||||
|
public static $clauseSwitches = array(
|
||||||
|
'JOIN' => 'FROM',
|
||||||
|
'INNER JOIN' => 'FROM',
|
||||||
|
'LEFT JOIN' => 'FROM',
|
||||||
|
'RIGHT JOIN' => 'FROM',
|
||||||
|
);
|
||||||
|
|
||||||
/** @var DibiConnection */
|
/** @var DibiConnection */
|
||||||
private $connection;
|
private $connection;
|
||||||
|
|
||||||
@@ -119,6 +127,11 @@ class DibiFluent extends DibiObject implements IDataSource
|
|||||||
$this->command = $clause;
|
$this->command = $clause;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// auto-switch to a clause
|
||||||
|
if (isset(self::$clauseSwitches[$clause])) {
|
||||||
|
$this->cursor = & $this->clauses[self::$clauseSwitches[$clause]];
|
||||||
|
}
|
||||||
|
|
||||||
// special types or argument
|
// special types or argument
|
||||||
if (count($args) === 1) {
|
if (count($args) === 1) {
|
||||||
$arg = $args[0];
|
$arg = $args[0];
|
||||||
|
Reference in New Issue
Block a user