mirror of
https://github.com/dg/dibi.git
synced 2025-08-03 20:57:36 +02:00
Partially reverts "DibiTranslator: object is initialized in constructor", fixes lazy connection [Closes #138]
This reverts commit 0071b80938
.
This commit is contained in:
@@ -51,7 +51,6 @@ final class DibiTranslator extends DibiObject
|
|||||||
public function __construct(DibiConnection $connection)
|
public function __construct(DibiConnection $connection)
|
||||||
{
|
{
|
||||||
$this->connection = $connection;
|
$this->connection = $connection;
|
||||||
$this->driver = $connection->getDriver();
|
|
||||||
$this->identifiers = new DibiHashMap(array($this, 'delimite'));
|
$this->identifiers = new DibiHashMap(array($this, 'delimite'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,6 +63,10 @@ final class DibiTranslator extends DibiObject
|
|||||||
*/
|
*/
|
||||||
public function translate(array $args)
|
public function translate(array $args)
|
||||||
{
|
{
|
||||||
|
if (!$this->driver) {
|
||||||
|
$this->driver = $this->connection->getDriver();
|
||||||
|
}
|
||||||
|
|
||||||
$args = array_values($args);
|
$args = array_values($args);
|
||||||
while (count($args) === 1 && is_array($args[0])) { // implicit array expansion
|
while (count($args) === 1 && is_array($args[0])) { // implicit array expansion
|
||||||
$args = array_values($args[0]);
|
$args = array_values($args[0]);
|
||||||
@@ -187,6 +190,10 @@ final class DibiTranslator extends DibiObject
|
|||||||
return "...";
|
return "...";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$this->driver) {
|
||||||
|
$this->driver = $this->connection->getDriver();
|
||||||
|
}
|
||||||
|
|
||||||
// array processing (with or without modifier)
|
// array processing (with or without modifier)
|
||||||
if ($value instanceof Traversable) {
|
if ($value instanceof Traversable) {
|
||||||
$value = iterator_to_array($value);
|
$value = iterator_to_array($value);
|
||||||
|
Reference in New Issue
Block a user