@@ -29,19 +29,19 @@ |
||
29 | 29 | if (preg_match('/^relationship:(11|1N|N1|NN):([a-zA-Z0-9]+):([a-zA-Z0-9]+)$/', $name, $matches)) { |
30 | 30 | $mode = null; |
31 | 31 | switch ($matches[1]) { |
32 | - case '11': |
|
33 | - $mode = self::RELATIONSHIP_ONE_TO_ONE; |
|
34 | - break; |
|
35 | - case '1N': |
|
36 | - $mode = self::RELATIONSHIP_ONE_TO_MANY; |
|
37 | - break; |
|
38 | - case 'NN': |
|
39 | - case 'N1': // TODO |
|
40 | - $mode = self::RELATIONSHIP_MANY_TO_MANY; |
|
41 | - break; |
|
42 | - // TODO: morph |
|
43 | - default: |
|
44 | - throw new ClassNotFoundException('Invalid relationship'); |
|
32 | + case '11': |
|
33 | + $mode = self::RELATIONSHIP_ONE_TO_ONE; |
|
34 | + break; |
|
35 | + case '1N': |
|
36 | + $mode = self::RELATIONSHIP_ONE_TO_MANY; |
|
37 | + break; |
|
38 | + case 'NN': |
|
39 | + case 'N1': // TODO |
|
40 | + $mode = self::RELATIONSHIP_MANY_TO_MANY; |
|
41 | + break; |
|
42 | + // TODO: morph |
|
43 | + default: |
|
44 | + throw new ClassNotFoundException('Invalid relationship'); |
|
45 | 45 | } |
46 | 46 | return static::factory($matches[2], $matches[3], $matches[1]); // $mode); |
47 | 47 | } |
@@ -14,10 +14,10 @@ discard block |
||
14 | 14 | public const RELATIONSHIP = "RELATIONSHIP"; |
15 | 15 | public const RELATIONSHIP_ONE_TO_ONE = "RELATIONSHIP_ONE_TO_ONE"; |
16 | 16 | public const RELATIONSHIP_ONE_TO_MANY = "RELATIONSHIP_ONE_TO_MANY"; |
17 | - public const RELATIONSHIP_MANY_TO_MANY = "RELATIONSHIP_MANY_TO_MANY"; |
|
17 | + public const RELATIONSHIP_MANY_TO_MANY = "RELATIONSHIP_MANY_TO_MANY"; |
|
18 | 18 | public const MORPH_ONE_TO_ONE = "RELATIONSHIP_ONE_TO_ONE"; |
19 | 19 | public const MORPH_ONE_TO_MANY = "RELATIONSHIP_ONE_TO_MANY"; |
20 | - public const MORPH_MANY_TO_MANY = "RELATIONSHIP_MANY_TO_MANY"; |
|
20 | + public const MORPH_MANY_TO_MANY = "RELATIONSHIP_MANY_TO_MANY"; |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * @param string $name relationship:[mode]:[source]:[target] |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | /** |
75 | 75 | * @var string |
76 | 76 | */ |
77 | - protected $targetClass= ''; |
|
77 | + protected $targetClass = ''; |
|
78 | 78 | |
79 | 79 | /** |
80 | 80 | * @var string |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | $name = $directive->name->value; |
307 | 307 | switch ($name) { |
308 | 308 | case 'migrationSoftDeletes': |
309 | - $this->createCode[] ='$table->softDeletes();'; |
|
309 | + $this->createCode[] = '$table->softDeletes();'; |
|
310 | 310 | break; |
311 | 311 | case 'migrationPrimaryIndex': |
312 | 312 | // TODO |
@@ -321,10 +321,10 @@ discard block |
||
321 | 321 | if (!count($indexFields)) { |
322 | 322 | throw new Exception("You must provide at least one field to an index"); |
323 | 323 | } |
324 | - $this->createCode[] ='$table->index("' . implode('", "', $indexFields) .'");'; |
|
324 | + $this->createCode[] = '$table->index("' . implode('", "', $indexFields) . '");'; |
|
325 | 325 | break; |
326 | 326 | case 'migrationSpatialIndex': |
327 | - $this->createCode[] ='$table->spatialIndex("' . $directive->arguments[0]->value->value .'");'; |
|
327 | + $this->createCode[] = '$table->spatialIndex("' . $directive->arguments[0]->value->value . '");'; |
|
328 | 328 | break; |
329 | 329 | |
330 | 330 | case 'migrationFulltextIndex': |
@@ -345,10 +345,10 @@ discard block |
||
345 | 345 | "\")');"; |
346 | 346 | break; |
347 | 347 | case 'migrationRememberToken': |
348 | - $this->createCode[] ='$table->rememberToken();'; |
|
348 | + $this->createCode[] = '$table->rememberToken();'; |
|
349 | 349 | break; |
350 | 350 | case 'migrationTimestamps': |
351 | - $this->createCode[] ='$table->timestamps();'; |
|
351 | + $this->createCode[] = '$table->timestamps();'; |
|
352 | 352 | break; |
353 | 353 | default: |
354 | 354 | } |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | break; |
284 | 284 | |
285 | 285 | case 'morphedByMany': |
286 | - $relationship = 'NN';// TODO Datatype_relationship::RELATIONSHIP_MANY_TO_MANY; // TODO |
|
286 | + $relationship = 'NN'; // TODO Datatype_relationship::RELATIONSHIP_MANY_TO_MANY; // TODO |
|
287 | 287 | $typeMap = $this->parser->getSchema()->getTypeMap(); |
288 | 288 | |
289 | 289 | foreach ($typeMap as $name => $object) { |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | * @var ObjectType $object |
296 | 296 | */ |
297 | 297 | |
298 | - if (str_starts_with((string)$name, '__')) { |
|
298 | + if (str_starts_with((string) $name, '__')) { |
|
299 | 299 | // internal type |
300 | 300 | continue; |
301 | 301 | } |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | continue; |
308 | 308 | } |
309 | 309 | |
310 | - $methodName = $this->getInflector()->pluralize(mb_strtolower((string)$name)); |
|
310 | + $methodName = $this->getInflector()->pluralize(mb_strtolower((string) $name)); |
|
311 | 311 | $this->class->addMethod($methodName) |
312 | 312 | ->setReturnType('\\Illuminate\\Database\\Eloquent\\Relations\\MorphToMany') |
313 | 313 | ->setPublic() |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | if ($generateRandom) { |
332 | 332 | $this->methodRandom->addBody( |
333 | 333 | '$data["' . $lowerName . '_id"] = function () {' . "\n" . |
334 | - ' return factory(' . $targetClass . '::class)->create()->id;' . "\n" . |
|
334 | + ' return factory(' . $targetClass . '::class)->create()->id;' . "\n" . |
|
335 | 335 | '};' |
336 | 336 | ); |
337 | 337 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | // $blade = FrameworkComposer::getByName('Blade'); |
79 | 79 | |
80 | 80 | if ($vue !== null) { |
81 | - $cardFieldNames = array_map(function (Field $f) { |
|
81 | + $cardFieldNames = array_map(function(Field $f) { |
|
82 | 82 | return $f->getName(); |
83 | 83 | }, $this->cardFields); |
84 | 84 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | protected function buildTemplateParameters(): void |
104 | 104 | { |
105 | 105 | $this->cardFields = $this->model->filterField( |
106 | - function (Field $field) { |
|
106 | + function(Field $field) { |
|
107 | 107 | return $field->getRenderable('card', false); |
108 | 108 | } |
109 | 109 | ); |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | 'Table', |
113 | 113 | [ |
114 | 114 | Table::ROW_NAMES => array_map( |
115 | - function (Field $field) { |
|
115 | + function(Field $field) { |
|
116 | 116 | return $field->getRenderable(Renderable::LABEL, $field->getName()); |
117 | 117 | }, |
118 | 118 | $this->cardFields |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | true |
130 | 130 | ); |
131 | 131 | $titleFields = $this->model->filterField( |
132 | - function (Field $field) { |
|
132 | + function(Field $field) { |
|
133 | 133 | var_dump($field->getRenderables()); |
134 | 134 | return $field->getRenderable('title', false); |
135 | 135 | } |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | |
170 | 170 | if ($mode == 'editable') { |
171 | 171 | $vue->setEditableTemplate( |
172 | - function (FrameworkVue $vue, array $data, Model $m) use ($stub) { |
|
172 | + function(FrameworkVue $vue, array $data, Model $m) use ($stub) { |
|
173 | 173 | return $this->templateCallback($stub, $vue, $data, $m); |
174 | 174 | } |
175 | 175 | ); |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | ); |
184 | 184 | } else { |
185 | 185 | $vue->setViewableTemplate( |
186 | - function (FrameworkVue $vue, array $data, Model $m) use ($stub) { |
|
186 | + function(FrameworkVue $vue, array $data, Model $m) use ($stub) { |
|
187 | 187 | return $this->templateCallback($stub, $vue, $data, $m); |
188 | 188 | } |
189 | 189 | ); |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | protected function makeGraphql(): void |
208 | 208 | { |
209 | 209 | $cardFieldNames = array_map( |
210 | - function (Field $field) { |
|
210 | + function(Field $field) { |
|
211 | 211 | return $field->getName(); |
212 | 212 | }, |
213 | 213 | $this->cardFields |
@@ -288,14 +288,14 @@ discard block |
||
288 | 288 | ]; |
289 | 289 | |
290 | 290 | $import = array_map( |
291 | - function ($i) use ($name) { |
|
291 | + function($i) use ($name) { |
|
292 | 292 | return "import {$name}$i from './{$name}$i.vue';"; |
293 | 293 | }, |
294 | 294 | $items |
295 | 295 | ); |
296 | 296 | |
297 | 297 | $export = array_map( |
298 | - function ($i) use ($name) { |
|
298 | + function($i) use ($name) { |
|
299 | 299 | return " {$name}$i,\n"; |
300 | 300 | }, |
301 | 301 | $items |