-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
184 additions
and
115 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
Modelarium/CodeGenerator/GraphQL/DatatypeGenerator/DatatypeGenerator_relationship.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Modelarium\CodeGenerator\GraphQL\DatatypeGenerator; | ||
|
||
use Formularium\CodeGenerator\GraphQL\GraphQLDatatypeGenerator; | ||
|
||
class DatatypeGenerator_integer extends GraphQLDatatypeGenerator | ||
{ | ||
public function getBasetype(): string | ||
{ | ||
return 'XXXXXXX'; | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
...larium/CodeGenerator/LaravelEloquent/DatatypeGenerator/DatatypeGenerator_relationship.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Formularium\CodeGenerator\LaravelEloquent\DatatypeGenerator; | ||
|
||
use Formularium\Field; | ||
use Formularium\CodeGenerator\CodeGenerator; | ||
use Formularium\CodeGenerator\LaravelEloquent\CodeGenerator as LaravelEloquentCodeGenerator; | ||
use Formularium\CodeGenerator\LaravelEloquent\LaravelEloquentDatatypeGenerator as LaravelEloquentLaravelEloquentDatatypeGenerator; | ||
use Formularium\DatabaseEnum; | ||
use Formularium\Datatype; | ||
|
||
class DatatypeGenerator_relationship extends LaravelEloquentLaravelEloquentDatatypeGenerator | ||
{ | ||
public function field(CodeGenerator $generator, Field $field) | ||
{ | ||
/** | ||
* @var LaravelEloquentCodeGenerator $generator | ||
*/ | ||
return "unsignedBigInteger('{$field->getName()}_id')" . | ||
($field->getValidatorOption(Datatype::REQUIRED, 'value', false) ? '' : '->nullable()'); | ||
// TODO: index | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
Modelarium/CodeGenerator/SQL/DatatypeGenerator/DatatypeGenerator_relationship.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Modelarium\CodeGenerator\SQL\DatatypeGenerator; | ||
|
||
use Formularium\Field; | ||
use Formularium\CodeGenerator\CodeGenerator; | ||
use Formularium\CodeGenerator\DatatypeGenerator; | ||
use Formularium\CodeGenerator\SQL\SQLDatatypeGenerator; | ||
use Formularium\CodeGenerator\SQL\CodeGenerator as SQLCodeGenerator; | ||
use Formularium\Datatype; | ||
|
||
class DatatypeGenerator_integer extends SQLDatatypeGenerator | ||
{ | ||
public function field(CodeGenerator $generator, Field $field) | ||
{ | ||
/** | ||
* @var SQLCodeGenerator $generator | ||
*/ | ||
return $this->getSQL( | ||
$field->getName(), | ||
'BIGINT', | ||
$field->getValidatorOption(Datatype::REQUIRED, 'value', false) | ||
); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
Modelarium/CodeGenerator/Typescript/DatatypeGenerator/DatatypeGenerator_relationship.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Modelarium\CodeGenerator\Typescript\DatatypeGenerator; | ||
|
||
use Formularium\Field; | ||
use Formularium\CodeGenerator\CodeGenerator; | ||
use Formularium\CodeGenerator\DatatypeGenerator; | ||
use Formularium\CodeGenerator\Typescript\CodeGenerator as TypescriptCodeGenerator; | ||
use Modelarium\Datatypes\Datatype_relationship; | ||
|
||
class DatatypeGenerator_relationship implements DatatypeGenerator | ||
{ | ||
public function datatypeDeclaration(CodeGenerator $generator) | ||
{ | ||
return ''; | ||
} | ||
|
||
public function field(CodeGenerator $generator, Field $field) | ||
{ | ||
/** | ||
* @var Datatype_relationship | ||
*/ | ||
$dt = $field->getDatatype(); | ||
|
||
/** | ||
* @var TypescriptCodeGenerator $generator | ||
*/ | ||
return $generator->fieldDeclaration($dt->getTarget(), $field->getName()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.