@@ -6,22 +6,22 @@ |
||
6 | 6 | |
7 | 7 | class SqlServerGrammar extends Base implements EagerLimitGrammar |
8 | 8 | { |
9 | - /** |
|
10 | - * Compile an initial path. TODO |
|
11 | - * |
|
12 | - * @param string $column |
|
13 | - * @return string |
|
14 | - */ |
|
15 | - public function compileFirstPathSegment($column) |
|
16 | - { |
|
17 | - $column = $this->wrap($column); |
|
9 | + /** |
|
10 | + * Compile an initial path. TODO |
|
11 | + * |
|
12 | + * @param string $column |
|
13 | + * @return string |
|
14 | + */ |
|
15 | + public function compileFirstPathSegment($column) |
|
16 | + { |
|
17 | + $column = $this->wrap($column); |
|
18 | 18 | |
19 | - return "left($column, charindex(?, $column) - 1)"; |
|
20 | - } |
|
19 | + return "left($column, charindex(?, $column) - 1)"; |
|
20 | + } |
|
21 | 21 | |
22 | - // TODO |
|
23 | - public function getFirstPathSegmentBindings($pathSeparator) |
|
24 | - { |
|
25 | - return [$pathSeparator]; |
|
26 | - } |
|
22 | + // TODO |
|
23 | + public function getFirstPathSegmentBindings($pathSeparator) |
|
24 | + { |
|
25 | + return [$pathSeparator]; |
|
26 | + } |
|
27 | 27 | } |
@@ -23,11 +23,11 @@ discard block |
||
23 | 23 | } else { |
24 | 24 | $grammar = $this->getEagerLimitGrammar(); |
25 | 25 | |
26 | - $sql = $grammar->compileFirstPathSegment( |
|
27 | - $this->related->qualifyColumn( |
|
28 | - $this->related->getPathName() |
|
29 | - ) |
|
30 | - ); |
|
26 | + $sql = $grammar->compileFirstPathSegment( |
|
27 | + $this->related->qualifyColumn( |
|
28 | + $this->related->getPathName() |
|
29 | + ) |
|
30 | + ); |
|
31 | 31 | |
32 | 32 | $column = new Expression($sql); |
33 | 33 | |
@@ -38,14 +38,14 @@ discard block |
||
38 | 38 | |
39 | 39 | $this->query->groupLimit($value, $column); |
40 | 40 | |
41 | - $this->query->getQuery()->addBinding( |
|
42 | - array_fill( |
|
43 | - 0, |
|
44 | - substr_count($sql, '?'), |
|
45 | - $this->related->getPathSeparator() |
|
46 | - ), |
|
47 | - 'groupBy' |
|
48 | - ); |
|
41 | + $this->query->getQuery()->addBinding( |
|
42 | + array_fill( |
|
43 | + 0, |
|
44 | + substr_count($sql, '?'), |
|
45 | + $this->related->getPathSeparator() |
|
46 | + ), |
|
47 | + 'groupBy' |
|
48 | + ); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | return $this; |
@@ -27,12 +27,12 @@ discard block |
||
27 | 27 | } else { |
28 | 28 | $grammar = $this->getEagerLimitGrammar(); |
29 | 29 | |
30 | - // TODO |
|
31 | - $sql = $grammar->compileFirstPathSegment( |
|
32 | - $this->related->qualifyColumn( |
|
33 | - $this->related->getPathName() |
|
34 | - ) |
|
35 | - ); |
|
30 | + // TODO |
|
31 | + $sql = $grammar->compileFirstPathSegment( |
|
32 | + $this->related->qualifyColumn( |
|
33 | + $this->related->getPathName() |
|
34 | + ) |
|
35 | + ); |
|
36 | 36 | |
37 | 37 | $column = new Expression($sql); |
38 | 38 | |
@@ -45,9 +45,9 @@ discard block |
||
45 | 45 | |
46 | 46 | $this->query->getQuery()->addBinding( |
47 | 47 | array_fill( |
48 | - 0, |
|
49 | - substr_count($sql, '?'), |
|
50 | - $this->related->getPathSeparator() |
|
48 | + 0, |
|
49 | + substr_count($sql, '?'), |
|
50 | + $this->related->getPathSeparator() |
|
51 | 51 | ), |
52 | 52 | 'groupBy' |
53 | 53 | ); |
@@ -25,13 +25,13 @@ discard block |
||
25 | 25 | if ($this->andSelf) { |
26 | 26 | $grammar = $this->getEagerLimitGrammar(); |
27 | 27 | |
28 | - $sql = $grammar->compileFirstPathSegment( |
|
29 | - $this->related->qualifyColumn( |
|
30 | - $this->related->getPathName() |
|
31 | - ) |
|
32 | - ); |
|
28 | + $sql = $grammar->compileFirstPathSegment( |
|
29 | + $this->related->qualifyColumn( |
|
30 | + $this->related->getPathName() |
|
31 | + ) |
|
32 | + ); |
|
33 | 33 | |
34 | - $column = new Expression($sql); |
|
34 | + $column = new Expression($sql); |
|
35 | 35 | |
36 | 36 | // TODO |
37 | 37 | // if ($grammar instanceof MySqlGrammar && $grammar->useLegacyGroupLimit($this->query->getQuery())) { |
@@ -40,14 +40,14 @@ discard block |
||
40 | 40 | |
41 | 41 | $this->query->groupLimit($value, $column); |
42 | 42 | |
43 | - $this->query->getQuery()->addBinding( |
|
44 | - array_fill( |
|
45 | - 0, |
|
46 | - substr_count($sql, '?'), |
|
47 | - $this->related->getPathSeparator() |
|
48 | - ), |
|
49 | - 'groupBy' |
|
50 | - ); |
|
43 | + $this->query->getQuery()->addBinding( |
|
44 | + array_fill( |
|
45 | + 0, |
|
46 | + substr_count($sql, '?'), |
|
47 | + $this->related->getPathSeparator() |
|
48 | + ), |
|
49 | + 'groupBy' |
|
50 | + ); |
|
51 | 51 | } else { |
52 | 52 | throw new RuntimeException('Eager loading limits are not supported on Descendants relationships.'); |
53 | 53 | } |