Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 12
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
TerminLocationRepository
0.00% covered (danger)
0.00%
0 / 12
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 search
0.00% covered (danger)
0.00%
0 / 12
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace Olz\Repository\Termine;
4
5use Doctrine\Common\Collections\Collection;
6use Doctrine\Common\Collections\Criteria;
7use Olz\Entity\Termine\TerminLocation;
8use Olz\Repository\Common\OlzRepository;
9
10/**
11 * @extends OlzRepository<TerminLocation>
12 */
13class TerminLocationRepository extends OlzRepository {
14    /**
15     * @param string[] $terms
16     *
17     * @return Collection<int, TerminLocation>&iterable<TerminLocation>
18     */
19    public function search(array $terms): Collection {
20        $criteria = Criteria::create()
21            ->where(Criteria::expr()->andX(
22                Criteria::expr()->eq('on_off', 1),
23                ...array_map(fn ($term) => Criteria::expr()->orX(
24                    Criteria::expr()->contains('name', $term),
25                    Criteria::expr()->contains('details', $term),
26                ), $terms),
27            ))
28            ->setFirstResult(0)
29            ->setMaxResults(1000000)
30        ;
31        return $this->matching($criteria);
32    }
33}