Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * @return $this
- */
- public function withFiles() {
- $this->onPostFetch[] = function(\Kdyby\Persistence\Query $self, \Kdyby\Persistence\Queryable $repository, \Iterator $iterator) {
- $ids = array_map(function($row) {
- return $row->id;
- }, iterator_to_array($iterator));
- $repository->createQueryBuilder('e')->select('e.id')
- ->leftJoin('e.files', 'f')
- ->andWhere('e.id IN (:ids)', $ids)
- ->addGroupBy('e.id')
- ->getQuery()
- ->getResult();
- };
- return $this;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement