Skip to content

Commit

Permalink
Allow to set fetchJoinCollection to ResultSet
Browse files Browse the repository at this point in the history
  • Loading branch information
fprochazka committed Oct 23, 2013
1 parent dfc5b0e commit a9dfc83
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/Kdyby/Doctrine/ResultSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ class ResultSet extends Nette\Object implements \Countable, \IteratorAggregate
*/
private $paginatedQuery;

/**
* @var bool
*/
private $fetchJoinCollection = TRUE;



/**
Expand All @@ -54,6 +59,18 @@ public function __construct(ORM\AbstractQuery $query)



/**
* @param bool $fetchJoinCollection
* @return ResultSet
*/
public function setFetchJoinCollection($fetchJoinCollection)
{
$this->fetchJoinCollection = (bool) $fetchJoinCollection;
return $this;
}



/**
* @param string|array $columns
*
Expand Down Expand Up @@ -190,7 +207,7 @@ public function count()
private function getPaginatedQuery()
{
if ($this->paginatedQuery === NULL) {
$this->paginatedQuery = new ResultPaginator($this->query);
$this->paginatedQuery = new ResultPaginator($this->query, $this->fetchJoinCollection);

This comment has been minimized.

Copy link
@mishak87

mishak87 Oct 25, 2013

Contributor

Shouldn't paginated query be set to null if fetchJoinCollection has changed?
Or exception be thrown if is already created.

This comment has been minimized.

Copy link
@fprochazka

fprochazka Oct 25, 2013

Author Member

Good catch.

}

return $this->paginatedQuery;
Expand Down

0 comments on commit a9dfc83

Please sign in to comment.