|
1
|
|
|
<?php declare(strict_types=1); |
|
2
|
|
|
|
|
3
|
|
|
namespace Modelarium\Laravel\Directives; |
|
4
|
|
|
|
|
5
|
|
|
use Modelarium\Laravel\Targets\ModelGenerator; |
|
6
|
|
|
use Modelarium\Laravel\Targets\Interfaces\ModelDirectiveInterface; |
|
7
|
|
|
|
|
8
|
|
|
class ModelExtendsDirective implements ModelDirectiveInterface |
|
9
|
|
|
{ |
|
10
|
|
|
public static function processModelTypeDirective( |
|
11
|
|
|
ModelGenerator $generator, |
|
12
|
|
|
\GraphQL\Language\AST\DirectiveNode $directive |
|
13
|
|
|
): void { |
|
14
|
|
|
foreach ($directive->arguments as $arg) { |
|
15
|
|
|
/** |
|
16
|
|
|
* @var \GraphQL\Language\AST\ArgumentNode $arg |
|
17
|
|
|
*/ |
|
18
|
|
|
|
|
19
|
|
|
/** @phpstan-ignore-next-line */ |
|
20
|
|
|
$value = $arg->value->value; |
|
21
|
|
|
|
|
22
|
|
|
switch ($arg->name->value) { |
|
23
|
|
|
case 'class': |
|
24
|
|
|
$generator->parentClassName = (string)$value; |
|
25
|
|
|
break; |
|
26
|
|
|
} |
|
27
|
|
|
} |
|
28
|
|
|
} |
|
29
|
|
|
|
|
30
|
|
|
public static function processModelFieldDirective( |
|
31
|
|
|
ModelGenerator $generator, |
|
32
|
|
|
\GraphQL\Type\Definition\FieldDefinition $field, |
|
33
|
|
|
\Formularium\Field $fieldFormularium, |
|
34
|
|
|
\GraphQL\Language\AST\DirectiveNode $directive |
|
35
|
|
|
): void { |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
public static function processModelRelationshipDirective( |
|
39
|
|
|
ModelGenerator $generator, |
|
40
|
|
|
\GraphQL\Type\Definition\FieldDefinition $field, |
|
41
|
|
|
\GraphQL\Language\AST\DirectiveNode $directive, |
|
42
|
|
|
\Formularium\Datatype $datatype = null |
|
43
|
|
|
): ?\Formularium\Datatype { |
|
44
|
|
|
return null; |
|
45
|
|
|
} |
|
46
|
|
|
} |
|
47
|
|
|
|