From cf193f2c1b06c21c56b52e9573847c33b68779e2 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Wed, 11 Nov 2015 12:48:01 +0100 Subject: [PATCH] RepositoryQuery: Initialize property $query before requiring a new table Since $this gets passed to Repository::requireTable() it may be possible that some repository tries to access the underlying native query so we need to ensure that we're able to actually provide it. refs #10567 --- library/Icinga/Repository/RepositoryQuery.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/library/Icinga/Repository/RepositoryQuery.php b/library/Icinga/Repository/RepositoryQuery.php index 532cae7c6..d227d9fde 100644 --- a/library/Icinga/Repository/RepositoryQuery.php +++ b/library/Icinga/Repository/RepositoryQuery.php @@ -86,9 +86,8 @@ class RepositoryQuery implements QueryInterface, SortRules, FilterColumns, Itera */ public function from($target, array $columns = null) { - $this->query = $this->repository->getDataSource()->select()->from( - $this->repository->requireTable($target, $this) - ); + $this->query = $this->repository->getDataSource()->select(); + $this->query->from($this->repository->requireTable($target, $this)); $this->query->columns($this->prepareQueryColumns($target, $columns)); $this->target = $target; return $this;