mirror of
https://github.com/dg/dibi.git
synced 2025-08-05 21:58:10 +02:00
- DibiResult: setWithTables() and setRowClass() provide a fluent interface
- DibiTranslator: enhanced arrays syntax
This commit is contained in:
@@ -151,7 +151,7 @@ class DibiResult extends DibiObject implements IDataSource
|
||||
/**
|
||||
* Qualifiy each column name with the table name?
|
||||
* @param bool
|
||||
* @return void
|
||||
* @return DibiResult provides a fluent interface
|
||||
* @throws DibiException
|
||||
*/
|
||||
final public function setWithTables($val)
|
||||
@@ -172,6 +172,7 @@ class DibiResult extends DibiObject implements IDataSource
|
||||
} else {
|
||||
$this->withTables = FALSE;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
@@ -190,11 +191,12 @@ class DibiResult extends DibiObject implements IDataSource
|
||||
/**
|
||||
* Set fetched object class. This class should extend the DibiRow class.
|
||||
* @param string
|
||||
* @return void
|
||||
* @return DibiResult provides a fluent interface
|
||||
*/
|
||||
public function setRowClass($class)
|
||||
{
|
||||
$this->class = $class;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -251,7 +251,7 @@ final class DibiTranslator extends DibiObject
|
||||
foreach ($value as $k => $v) {
|
||||
$pair = explode('%', $k, 2); // split into identifier & modifier
|
||||
$vx[] = $this->delimite($pair[0]) . '='
|
||||
. $this->formatValue($v, isset($pair[1]) ? $pair[1] : FALSE);
|
||||
. $this->formatValue($v, isset($pair[1]) ? $pair[1] : is_array($v) ? 'ex' : FALSE);
|
||||
}
|
||||
return implode(', ', $vx);
|
||||
|
||||
@@ -259,7 +259,7 @@ final class DibiTranslator extends DibiObject
|
||||
case 'l': // (val, val, ...)
|
||||
foreach ($value as $k => $v) {
|
||||
$pair = explode('%', $k, 2); // split into identifier & modifier
|
||||
$vx[] = $this->formatValue($v, isset($pair[1]) ? $pair[1] : FALSE);
|
||||
$vx[] = $this->formatValue($v, isset($pair[1]) ? $pair[1] : is_array($v) ? 'ex' : FALSE);
|
||||
}
|
||||
return '(' . ($vx ? implode(', ', $vx) : 'NULL') . ')';
|
||||
|
||||
@@ -268,7 +268,7 @@ final class DibiTranslator extends DibiObject
|
||||
foreach ($value as $k => $v) {
|
||||
$pair = explode('%', $k, 2); // split into identifier & modifier
|
||||
$kx[] = $this->delimite($pair[0]);
|
||||
$vx[] = $this->formatValue($v, isset($pair[1]) ? $pair[1] : FALSE);
|
||||
$vx[] = $this->formatValue($v, isset($pair[1]) ? $pair[1] : is_array($v) ? 'ex' : FALSE);
|
||||
}
|
||||
return '(' . implode(', ', $kx) . ') VALUES (' . implode(', ', $vx) . ')';
|
||||
|
||||
|
Reference in New Issue
Block a user