RepositoryQuery: Ensure that we'll adjust a copy of a filter

This commit is contained in:
Johannes Meyer 2015-05-26 14:32:47 +02:00
parent 899a00e983
commit 237b50f953
1 changed files with 2 additions and 0 deletions

View File

@ -185,6 +185,7 @@ class RepositoryQuery implements QueryInterface, Iterator
*/ */
public function setFilter(Filter $filter) public function setFilter(Filter $filter)
{ {
$filter = clone $filter;
$this->repository->requireFilter($this->target, $filter); $this->repository->requireFilter($this->target, $filter);
$this->query->setFilter($filter); $this->query->setFilter($filter);
return $this; return $this;
@ -201,6 +202,7 @@ class RepositoryQuery implements QueryInterface, Iterator
*/ */
public function addFilter(Filter $filter) public function addFilter(Filter $filter)
{ {
$filter = clone $filter;
$this->repository->requireFilter($this->target, $filter); $this->repository->requireFilter($this->target, $filter);
$this->query->addFilter($filter); $this->query->addFilter($filter);
return $this; return $this;