/** * Find multiple entities. * * @return CollectionFinderInterface The responsible Finder object * * @throws OrmException if there was an error getting the entities */ public function findAll() { $finder = $this->dataMapper->findAll(); foreach ($this->restrictions as $filter) { $finder = $finder->with($filter['field'], $filter['op'], $filter['value']); } return $finder; }
/** * @testdox findAll() respects given restrictions */ public function testFindAllRestricted() { $this->dataMapper->expects($this->once())->method('findAll'); $this->collectionFinder->expects($this->once())->method('with')->with('key', Operator::EQUAL, 'value'); $this->repo->restrictTo('key', Operator::EQUAL, 'value'); /** @noinspection PhpUnusedLocalVariableInspection */ $article = $this->repo->findAll()->getItems(); }