mirror of
https://github.com/dg/dibi.git
synced 2025-08-05 05:37:39 +02:00
- added connection directive 'substitutes'
- better ArrayObject handling in DibiTranslator
This commit is contained in:
@@ -98,6 +98,12 @@ class DibiConnection extends DibiObject
|
||||
$this->setProfiler(new $class);
|
||||
}
|
||||
|
||||
if (!empty($config['substitutes'])) {
|
||||
foreach ($config['substitutes'] as $key => $value) {
|
||||
dibi::addSubst($key, $value);
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($config['lazy'])) {
|
||||
$this->connect();
|
||||
}
|
||||
|
@@ -142,6 +142,10 @@ final class DibiTranslator extends DibiObject
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($arg instanceof ArrayObject) {
|
||||
$arg = (array) $arg;
|
||||
}
|
||||
|
||||
if (is_array($arg)) {
|
||||
if (is_string(key($arg))) {
|
||||
// associative array -> autoselect between SET or VALUES & LIST
|
||||
@@ -196,8 +200,11 @@ final class DibiTranslator extends DibiObject
|
||||
public function formatValue($value, $modifier)
|
||||
{
|
||||
// array processing (with or without modifier)
|
||||
if (is_array($value) || $value instanceof ArrayObject) {
|
||||
if ($value instanceof ArrayObject) {
|
||||
$value = (array) $value;
|
||||
}
|
||||
|
||||
if (is_array($value)) {
|
||||
$vx = $kx = array();
|
||||
switch ($modifier) {
|
||||
case 'and':
|
||||
|
Reference in New Issue
Block a user