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
This commit is contained in:
Johannes Meyer 2015-11-11 12:48:01 +01:00
parent 31b584b338
commit cf193f2c1b
1 changed files with 2 additions and 3 deletions

View File

@ -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;