-
-
Notifications
You must be signed in to change notification settings - Fork 12
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
61 changed files
with
1,609 additions
and
26 deletions.
There are no files selected for viewing
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); | ||
/** | ||
* Spiral Framework. | ||
* | ||
* @license MIT | ||
* @author Anton Titov (Wolfy-J) | ||
*/ | ||
|
||
namespace Cycle\Annotated\Annotation\Relation; | ||
|
||
use Spiral\Annotations\Parser; | ||
|
||
final class BelongsTo extends Relation | ||
{ | ||
protected const NAME = 'belongsTo'; | ||
protected const OPTIONS = [ | ||
'cascade' => Parser::BOOL, | ||
'nullable' => Parser::BOOL, | ||
'innerKey' => Parser::STRING, | ||
'outerKey' => Parser::STRING, | ||
'fkCreate' => Parser::BOOL, | ||
'fkAction' => Parser::STRING, | ||
'indexCreate' => Parser::BOOL, | ||
]; | ||
} |
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,26 @@ | ||
<?php declare(strict_types=1); | ||
/** | ||
* Spiral Framework. | ||
* | ||
* @license MIT | ||
* @author Anton Titov (Wolfy-J) | ||
*/ | ||
|
||
namespace Cycle\Annotated\Annotation\Relation; | ||
|
||
use Spiral\Annotations\Parser; | ||
|
||
final class HasMany extends Relation | ||
{ | ||
protected const NAME = 'hasMany'; | ||
protected const OPTIONS = [ | ||
'cascade' => Parser::BOOL, | ||
'nullable' => Parser::BOOL, | ||
'innerKey' => Parser::STRING, | ||
'outerKey' => Parser::STRING, | ||
'where' => [Parser::MIXED], | ||
'fkCreate' => Parser::BOOL, | ||
'fkAction' => Parser::STRING, | ||
'indexCreate' => Parser::BOOL, | ||
]; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php declare(strict_types=1); | ||
/** | ||
* Spiral Framework. | ||
* | ||
* @license MIT | ||
* @author Anton Titov (Wolfy-J) | ||
*/ | ||
|
||
namespace Cycle\Annotated\Annotation\Relation; | ||
|
||
use Spiral\Annotations\AbstractAnnotation; | ||
use Spiral\Annotations\Parser; | ||
|
||
final class Inversed extends AbstractAnnotation | ||
{ | ||
protected const INVERSED = 'inversed'; | ||
protected const SCHEMA = [ | ||
'type' => Parser::STRING, | ||
'name' => Parser::STRING | ||
]; | ||
|
||
/** @var string|null */ | ||
protected $type; | ||
|
||
/** @var string|null */ | ||
protected $name; | ||
|
||
/** | ||
* @return bool | ||
*/ | ||
public function isValid(): bool | ||
{ | ||
return $this->type !== null && $this->name !== null; | ||
} | ||
|
||
/** | ||
* @return string|null | ||
*/ | ||
public function getType(): ?string | ||
{ | ||
return $this->type; | ||
} | ||
|
||
/** | ||
* @return string|null | ||
*/ | ||
public function getRelation(): ?string | ||
{ | ||
return $this->name; | ||
} | ||
} |
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,31 @@ | ||
<?php declare(strict_types=1); | ||
/** | ||
* Spiral Framework. | ||
* | ||
* @license MIT | ||
* @author Anton Titov (Wolfy-J) | ||
*/ | ||
|
||
namespace Cycle\Annotated\Annotation\Relation; | ||
|
||
use Spiral\Annotations\Parser; | ||
|
||
final class ManyToMany extends Relation | ||
{ | ||
protected const NAME = 'manyToMany'; | ||
protected const OPTIONS = [ | ||
'cascade' => Parser::BOOL, | ||
'nullable' => Parser::BOOL, | ||
'innerKey' => Parser::STRING, | ||
'outerKey' => Parser::STRING, | ||
'though' => Parser::STRING, | ||
'thoughInnerKey' => Parser::STRING, | ||
'thoughOuterKey' => Parser::STRING, | ||
'thoughConstrain' => Parser::STRING, | ||
'thoughWhere' => [Parser::MIXED], | ||
'where' => [Parser::MIXED], | ||
'fkCreate' => Parser::BOOL, | ||
'fkAction' => Parser::STRING, | ||
'indexCreate' => Parser::BOOL, | ||
]; | ||
} |
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,26 @@ | ||
<?php declare(strict_types=1); | ||
/** | ||
* Spiral Framework. | ||
* | ||
* @license MIT | ||
* @author Anton Titov (Wolfy-J) | ||
*/ | ||
|
||
namespace Cycle\Annotated\Annotation\Relation\Morphed; | ||
|
||
use Cycle\Annotated\Annotation\Relation\Relation; | ||
use Spiral\Annotations\Parser; | ||
|
||
final class BelongsToMorphed extends Relation | ||
{ | ||
protected const NAME = 'belongsToMorphed'; | ||
protected const OPTIONS = [ | ||
'cascade' => Parser::BOOL, | ||
'nullable' => Parser::BOOL, | ||
'innerKey' => Parser::STRING, | ||
'outerKey' => Parser::STRING, | ||
'morphKey' => Parser::STRING, | ||
'morphKeyLength' => Parser::INTEGER, | ||
'indexCreate' => Parser::BOOL, | ||
]; | ||
} |
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,27 @@ | ||
<?php declare(strict_types=1); | ||
/** | ||
* Spiral Framework. | ||
* | ||
* @license MIT | ||
* @author Anton Titov (Wolfy-J) | ||
*/ | ||
|
||
namespace Cycle\Annotated\Annotation\Relation\Morphed; | ||
|
||
use Cycle\Annotated\Annotation\Relation\Relation; | ||
use Spiral\Annotations\Parser; | ||
|
||
final class MorphedHasMany extends Relation | ||
{ | ||
protected const NAME = 'morphedHasMany'; | ||
protected const OPTIONS = [ | ||
'cascade' => Parser::BOOL, | ||
'nullable' => Parser::BOOL, | ||
'innerKey' => Parser::STRING, | ||
'outerKey' => Parser::STRING, | ||
'morphKey' => Parser::STRING, | ||
'morphKeyLength' => Parser::INTEGER, | ||
'where' => [Parser::MIXED], | ||
'indexCreate' => Parser::BOOL, | ||
]; | ||
} |
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,27 @@ | ||
<?php declare(strict_types=1); | ||
/** | ||
* Spiral Framework. | ||
* | ||
* @license MIT | ||
* @author Anton Titov (Wolfy-J) | ||
*/ | ||
|
||
namespace Cycle\Annotated\Annotation\Relation\Morphed; | ||
|
||
use Cycle\Annotated\Annotation\Relation\Relation; | ||
use Spiral\Annotations\Parser; | ||
|
||
final class MorphedHasOne extends Relation | ||
{ | ||
protected const NAME = 'morphedHasOne'; | ||
protected const OPTIONS = [ | ||
'cascade' => Parser::BOOL, | ||
'nullable' => Parser::BOOL, | ||
'innerKey' => Parser::STRING, | ||
'outerKey' => Parser::STRING, | ||
'morphKey' => Parser::STRING, | ||
'morphKeyLength' => Parser::INTEGER, | ||
'where' => [Parser::MIXED], | ||
'indexCreate' => Parser::BOOL, | ||
]; | ||
} |
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); | ||
/** | ||
* Spiral Framework. | ||
* | ||
* @license MIT | ||
* @author Anton Titov (Wolfy-J) | ||
*/ | ||
|
||
namespace Cycle\Annotated\Annotation\Relation; | ||
|
||
use Spiral\Annotations\Parser; | ||
|
||
final class RefersTo extends Relation | ||
{ | ||
protected const NAME = 'refersTo'; | ||
protected const OPTIONS = [ | ||
'cascade' => Parser::BOOL, | ||
'nullable' => Parser::BOOL, | ||
'innerKey' => Parser::STRING, | ||
'outerKey' => Parser::STRING, | ||
'fkCreate' => Parser::BOOL, | ||
'fkAction' => Parser::STRING, | ||
'indexCreate' => Parser::BOOL, | ||
]; | ||
} |
Oops, something went wrong.