From f5f94a84dd685a1c39a2302c000e666d19ab2768 Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Fri, 2 Dec 2016 11:50:40 +0100 Subject: [PATCH] Set container to result instance when doing advanced execute --- src/Pool.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Pool.php b/src/Pool.php index f025ba5..7c1efc1 100644 --- a/src/Pool.php +++ b/src/Pool.php @@ -471,7 +471,12 @@ public function findBySql($type, $sql, ...$arguments) $return_by_value = $type; } - return $this->connection->advancedExecute($sql, $arguments, ConnectionInterface::LOAD_ALL_ROWS, $return_by, $return_by_value, [&$this->connection, &$this, &$this->log]); + if ($this->hasContainer()) { + return $this->connection->advancedExecute($sql, $arguments, ConnectionInterface::LOAD_ALL_ROWS, $return_by, $return_by_value, [&$this->connection, &$this, &$this->log], $this->getContainer()); + } else { + return $this->connection->advancedExecute($sql, $arguments, ConnectionInterface::LOAD_ALL_ROWS, $return_by, $return_by_value, [&$this->connection, &$this, &$this->log]); + } + } else { throw new InvalidArgumentException("Type '$type' is not registered"); }