1
|
|
|
<?php declare(strict_types=1); |
2
|
|
|
|
3
|
|
|
namespace Modelarium\Laravel\Directives; |
4
|
|
|
|
5
|
|
|
use Illuminate\Support\Str; |
6
|
|
|
use Modelarium\Exception\DirectiveException; |
7
|
|
|
use Modelarium\Exception\Exception; |
8
|
|
|
use Modelarium\Laravel\Targets\MigrationGenerator; |
9
|
|
|
use Modelarium\Laravel\Targets\ModelGenerator; |
10
|
|
|
use Modelarium\Laravel\Targets\Interfaces\MigrationDirectiveInterface; |
11
|
|
|
use Modelarium\Laravel\Targets\Interfaces\ModelDirectiveInterface; |
12
|
|
|
use Modelarium\Laravel\Targets\MigrationCodeFragment; |
13
|
|
|
|
14
|
|
|
class MigrationPrimaryIndexDirective implements MigrationDirectiveInterface, ModelDirectiveInterface |
15
|
|
|
{ |
16
|
|
|
public static function processMigrationTypeDirective( |
17
|
|
|
MigrationGenerator $generator, |
18
|
|
|
\GraphQL\Language\AST\DirectiveNode $directive |
19
|
|
|
): void { |
20
|
|
|
throw new Exception("Primary index is not implemented yet"); |
21
|
|
|
} |
22
|
|
|
|
23
|
|
|
public static function processMigrationFieldDirective( |
24
|
|
|
MigrationGenerator $generator, |
25
|
|
|
\GraphQL\Type\Definition\FieldDefinition $field, |
26
|
|
|
\GraphQL\Language\AST\DirectiveNode $directive, |
27
|
|
|
MigrationCodeFragment $code |
28
|
|
|
): void { |
29
|
|
|
throw new DirectiveException("Directive not supported here"); |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
public static function processMigrationRelationshipDirective( |
33
|
|
|
MigrationGenerator $generator, |
34
|
|
|
\GraphQL\Type\Definition\FieldDefinition $field, |
35
|
|
|
\GraphQL\Language\AST\DirectiveNode $directive, |
36
|
|
|
MigrationCodeFragment $code |
37
|
|
|
): void { |
38
|
|
|
throw new DirectiveException("Directive not supported here"); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
public static function processModelTypeDirective( |
42
|
|
|
ModelGenerator $generator, |
43
|
|
|
\GraphQL\Language\AST\DirectiveNode $directive |
44
|
|
|
): void { |
45
|
|
|
throw new Exception("Primary index is not implemented yet"); |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
public static function processModelFieldDirective( |
49
|
|
|
ModelGenerator $generator, |
50
|
|
|
\GraphQL\Type\Definition\FieldDefinition $field, |
51
|
|
|
\Formularium\Field $fieldFormularium, |
52
|
|
|
\GraphQL\Language\AST\DirectiveNode $directive |
53
|
|
|
): void { |
54
|
|
|
// nothing |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
public static function processModelRelationshipDirective( |
58
|
|
|
ModelGenerator $generator, |
59
|
|
|
\GraphQL\Type\Definition\FieldDefinition $field, |
60
|
|
|
\GraphQL\Language\AST\DirectiveNode $directive, |
61
|
|
|
\Formularium\Datatype $datatype = null |
62
|
|
|
): ?\Formularium\Datatype { |
63
|
|
|
return null; |
64
|
|
|
} |
65
|
|
|
} |
66
|
|
|
|