Passed
Pull Request — master (#10)
by
unknown
11:06
created
src/EagerLoadedDataList.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
     {
66 66
         return array_filter(
67 67
             $this->withList,
68
-            function ($dep) use ($list) {
68
+            function($dep) use ($list) {
69 69
                 return array_key_exists($dep[0], $list);
70 70
             }
71 71
         );
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
             $fields[] = "\"{$dep}ID\"";
125 125
         }
126 126
         $table = DataObject::getSchema()->tableName($this->dataClass);
127
-        $data = new SQLSelect($fields, '"' . $table . '"', ['"ID" IN (' . implode(',', $ids) . ')']);
127
+        $data = new SQLSelect($fields, '"'.$table.'"', ['"ID" IN ('.implode(',', $ids).')']);
128 128
         $data = Utils::EnsureArray($data->execute(), 'ID');
129 129
 
130 130
         foreach ($withHasOnes as $depSeq) {
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
             while (count($uniqueIDs)) {
143 143
                 $IDsubset = array_splice($uniqueIDs, 0, self::ID_LIMIT);
144 144
                 $result = DataObject::get($depClass)->filter('ID', $IDsubset);
145
-                if (count($depSeq)>1) {
145
+                if (count($depSeq) > 1) {
146 146
                     $result = $result
147 147
                         ->with(implode('.', array_slice($depSeq, 1)));
148 148
                 }
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
                 'map' => [],
180 180
             ];
181 181
             $result = DataObject::get($depClass)->filter($depKey, $data);
182
-            if (count($depSeq)>1) {
182
+            if (count($depSeq) > 1) {
183 183
                 $result = $result
184 184
                     ->with(implode('.', array_slice($depSeq, 1)));
185 185
             }
@@ -221,8 +221,8 @@  discard block
 block discarded – undo
221 221
 
222 222
                 $table = DataObject::getSchema()->tableName($throughClass);
223 223
 
224
-                $childField = $depData['to']. 'ID';
225
-                $parentField = $depData['from']. 'ID';
224
+                $childField = $depData['to'].'ID';
225
+                $parentField = $depData['from'].'ID';
226 226
 
227 227
                 if ($defaultSort = Config::inst()->get($throughClass, 'default_sort')) {
228 228
                     $sort[] = $defaultSort;
@@ -243,12 +243,12 @@  discard block
 block discarded – undo
243 243
 
244 244
             $idsQuery = SQLSelect::create(
245 245
                 [
246
-                    '"' . $childField . '"',
247
-                    '"' . $parentField . '"',
246
+                    '"'.$childField.'"',
247
+                    '"'.$parentField.'"',
248 248
                 ],
249
-                '"' . $table . '"',
249
+                '"'.$table.'"',
250 250
                 [
251
-                    '"' . $parentField . '" IN (' . implode(',', $data) . ')'
251
+                    '"'.$parentField.'" IN ('.implode(',', $data).')'
252 252
                 ],
253 253
                 $sort,
254 254
             )->execute();
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 
268 268
             if (count($relListReverted)) {
269 269
                 $result = DataObject::get($depClass)->filter('ID', array_keys($relListReverted));
270
-                if (count($depSeq)>1) {
270
+                if (count($depSeq) > 1) {
271 271
                     $result = $result
272 272
                         ->with(implode('.', array_slice($depSeq, 1)));
273 273
                 }
@@ -308,8 +308,8 @@  discard block
 block discarded – undo
308 308
             }
309 309
             if (!method_exists($item, 'addEagerRelation')) {
310 310
                 throw new EagerLoadingException(
311
-                    "Model {$item->ClassName} must include " .
312
-                    EagerLoaderMultiAccessor::class .
311
+                    "Model {$item->ClassName} must include ".
312
+                    EagerLoaderMultiAccessor::class.
313 313
                     " trait to use eager loading for \$has_many"
314 314
                 );
315 315
             }
@@ -331,8 +331,8 @@  discard block
 block discarded – undo
331 331
             }
332 332
             if (!method_exists($item, 'addEagerRelation')) {
333 333
                 throw new EagerLoadingException(
334
-                    "Model {$item->ClassName} must include " .
335
-                    EagerLoaderMultiAccessor::class .
334
+                    "Model {$item->ClassName} must include ".
335
+                    EagerLoaderMultiAccessor::class.
336 336
                     " trait to use eager loading for \$many_many"
337 337
                 );
338 338
             }
Please login to merge, or discard this patch.
tests/EagerloadTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -114,7 +114,7 @@
 block discarded – undo
114 114
         foreach ($teams as $team) {
115 115
             $supporters = $team->Supporters()->map()->toArray();
116 116
             // print_r(ProxyDBCounterExtension::getQueries());
117
-            switch($team->Title){
117
+            switch ($team->Title) {
118 118
                 case 'The Hurricanes':
119 119
                     $this->assertCount(3, $supporters);
120 120
                     $this->assertEquals([
Please login to merge, or discard this patch.