Conditions | 6 |
Paths | 10 |
Total Lines | 22 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 42 |
Changes | 0 |
1 | <?php |
||
45 | protected function applyEmptyOrderByParams(Connection $db) |
||
46 | { |
||
47 | if ($this->fixedOrder) { |
||
48 | $values = $this->{$this->fixedOrderColumn()}; |
||
49 | if (!is_array($values)) { |
||
50 | $values = is_string($values) ? StringHelper::split($values) : [$values]; |
||
51 | } |
||
52 | |||
53 | if (empty($values)) { |
||
54 | throw new QueryAbortedException; |
||
55 | } |
||
56 | |||
57 | // Order the elements in the exact order that the Search service returned them in |
||
58 | if (!$db instanceof CraftConnection) { |
||
59 | throw new Exception('The database connection doesn\'t support fixed ordering.'); |
||
60 | } |
||
61 | |||
62 | $this->orderBy = [new FixedOrderExpression($this->fixedOrderColumn(), $values, $db)]; |
||
63 | } else { |
||
64 | $this->traitApplyEmptyOrderByParams($db); |
||
65 | } |
||
66 | } |
||
67 | } |
||
68 |