Total Complexity | 5 |
Total Lines | 34 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 1 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
17 | final class QueryBuilder extends Builder |
||
18 | { |
||
19 | public const string E_NOT_ALLOWED_METHOD_CALL = 'When eager loading relations queries must return full entities'; |
||
|
|||
20 | |||
21 | /** |
||
22 | * @param mixed $distinct |
||
23 | * @return BuilderInterface |
||
24 | * @throws \LogicException |
||
25 | */ |
||
26 | public function distinct($distinct): BuilderInterface |
||
27 | { |
||
28 | throw new \LogicException(self::E_NOT_ALLOWED_METHOD_CALL); |
||
29 | } |
||
30 | |||
31 | /** |
||
32 | * @param mixed $columns |
||
33 | * @return BuilderInterface |
||
34 | * @throws \LogicException |
||
35 | */ |
||
36 | public function columns($columns): BuilderInterface |
||
37 | { |
||
38 | throw new \LogicException(self::E_NOT_ALLOWED_METHOD_CALL); |
||
39 | } |
||
40 | |||
41 | /** |
||
42 | * Replacing where to andWhere in order to avoid loosing relationship conditions |
||
43 | */ |
||
44 | public function where(string $conditions, array $bindParams = [], array $bindTypes = []): BuilderInterface |
||
45 | { |
||
46 | if (!empty($this->conditions)) { |
||
47 | $appendCondition = is_array($this->conditions)? implode(') AND (', $this->conditions) : $this->conditions; |
||
48 | $conditions = '(' . $appendCondition . ') AND (' . $conditions . ')'; |
||
49 | } |
||
50 | return parent::where($conditions, $bindParams, $bindTypes); |
||
51 | } |
||
53 |