Skip to content

Commit

Permalink
no relation constrains
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfy-j committed Mar 28, 2019
1 parent 48fae43 commit f0f4fd6
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 34 deletions.
29 changes: 13 additions & 16 deletions src/Generator/GenerateRelations.php
Expand Up @@ -27,22 +27,19 @@ final class GenerateRelations implements GeneratorInterface
{
// aliases between option names and their internal IDs
public const OPTION_MAP = [
'cascade' => Relation::CASCADE,
'nullable' => Relation::NULLABLE,
'innerKey' => Relation::INNER_KEY,
'outerKey' => Relation::OUTER_KEY,
'morphKey' => Relation::MORPH_KEY,
'though' => Relation::THOUGH_ENTITY,
'thoughInnerKey' => Relation::THOUGH_INNER_KEY,
'thoughOuterKey' => Relation::THOUGH_OUTER_KEY,
'thoughConstrain' => Relation::THOUGH_CONSTRAIN,
'thoughWhere' => Relation::THOUGH_WHERE,
'constrain' => Relation::CONSTRAIN,
'where' => Relation::WHERE,
'fkCreate' => RelationSchema::FK_CREATE,
'fkAction' => RelationSchema::FK_ACTION,
'indexCreate' => RelationSchema::INDEX_CREATE,
'morphKeyLength' => RelationSchema::MORPH_KEY_LENGTH
'nullable' => Relation::NULLABLE,
'innerKey' => Relation::INNER_KEY,
'outerKey' => Relation::OUTER_KEY,
'morphKey' => Relation::MORPH_KEY,
'though' => Relation::THOUGH_ENTITY,
'thoughInnerKey' => Relation::THOUGH_INNER_KEY,
'thoughOuterKey' => Relation::THOUGH_OUTER_KEY,
'thoughWhere' => Relation::THOUGH_WHERE,
'where' => Relation::WHERE,
'fkCreate' => RelationSchema::FK_CREATE,
'fkAction' => RelationSchema::FK_ACTION,
'indexCreate' => RelationSchema::INDEX_CREATE,
'morphKeyLength' => RelationSchema::MORPH_KEY_LENGTH
];

/** @var OptionSchema */
Expand Down
3 changes: 0 additions & 3 deletions src/Relation/BelongsTo.php
Expand Up @@ -28,9 +28,6 @@ final class BelongsTo extends RelationSchema implements InversableInterface
// save with parent
Relation::CASCADE => true,

// use outer entity constrain by default
Relation::CONSTRAIN => true,

// nullable by default
Relation::NULLABLE => true,

Expand Down
3 changes: 0 additions & 3 deletions src/Relation/HasMany.php
Expand Up @@ -28,9 +28,6 @@ class HasMany extends RelationSchema implements InversableInterface
// save with parent
Relation::CASCADE => true,

// use outer entity constrain by default
Relation::CONSTRAIN => true,

// custom where condition
Relation::WHERE => [],

Expand Down
3 changes: 0 additions & 3 deletions src/Relation/HasOne.php
Expand Up @@ -28,9 +28,6 @@ final class HasOne extends RelationSchema implements InversableInterface
// save with parent
Relation::CASCADE => true,

// use outer entity constrain by default
Relation::CONSTRAIN => true,

// not nullable by default
Relation::NULLABLE => false,

Expand Down
6 changes: 0 additions & 6 deletions src/Relation/ManyToMany.php
Expand Up @@ -28,9 +28,6 @@ class ManyToMany extends RelationSchema implements InversableInterface
// save with parent
Relation::CASCADE => true,

// use outer entity constrain by default
Relation::CONSTRAIN => true,

// nullable by default
Relation::NULLABLE => true,

Expand All @@ -55,9 +52,6 @@ class ManyToMany extends RelationSchema implements InversableInterface
// role + outerKey by default
Relation::THOUGH_OUTER_KEY => '{target:role}_{outerKey}',

// apply pivot constrain
Relation::THOUGH_CONSTRAIN => true,

// custom pivot where
Relation::THOUGH_WHERE => [],

Expand Down
3 changes: 0 additions & 3 deletions src/Relation/RefersTo.php
Expand Up @@ -28,9 +28,6 @@ class RefersTo extends RelationSchema
// save with parent
Relation::CASCADE => true,

// use outer entity constrain by default
Relation::CONSTRAIN => true,

// nullable by default
Relation::NULLABLE => true,

Expand Down

0 comments on commit f0f4fd6

Please sign in to comment.