mirror of
https://github.com/dg/dibi.git
synced 2025-08-05 21:58:10 +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,
|
||||
);
|
||||
|
||||
/** @var array clauses */
|
||||
public static $clauseSwitches = array(
|
||||
'JOIN' => 'FROM',
|
||||
'INNER JOIN' => 'FROM',
|
||||
'LEFT JOIN' => 'FROM',
|
||||
'RIGHT JOIN' => 'FROM',
|
||||
);
|
||||
|
||||
/** @var DibiConnection */
|
||||
private $connection;
|
||||
|
||||
@@ -119,6 +127,11 @@ class DibiFluent extends DibiObject implements IDataSource
|
||||
$this->command = $clause;
|
||||
}
|
||||
|
||||
// auto-switch to a clause
|
||||
if (isset(self::$clauseSwitches[$clause])) {
|
||||
$this->cursor = & $this->clauses[self::$clauseSwitches[$clause]];
|
||||
}
|
||||
|
||||
// special types or argument
|
||||
if (count($args) === 1) {
|
||||
$arg = $args[0];
|
||||
|
Reference in New Issue
Block a user