Abstract Class Yiisoft\Yii\Cycle\Schema\Conveyor\SchemaConveyor
| Inheritance | Yiisoft\Yii\Cycle\Schema\Conveyor\SchemaConveyor |
|---|---|
| Implements | Yiisoft\Yii\Cycle\Schema\SchemaConveyorInterface |
| Subclasses | Yiisoft\Yii\Cycle\Schema\Conveyor\MetadataSchemaConveyor |
Protected Properties
| Property | Type | Description | Defined By |
|---|---|---|---|
| $container | \Psr\Container\ContainerInterface | Yiisoft\Yii\Cycle\Schema\Conveyor\SchemaConveyor | |
| $conveyor | array | Yiisoft\Yii\Cycle\Schema\Conveyor\SchemaConveyor |
Public Methods
Constants
| Constant | Value | Description | Defined By |
|---|---|---|---|
| STAGE_INDEX | 'index' | Declare entities and their fields | Yiisoft\Yii\Cycle\Schema\SchemaConveyorInterface |
| STAGE_POSTPROCESS | 'postprocess' | Post processing | Yiisoft\Yii\Cycle\Schema\SchemaConveyorInterface |
| STAGE_RENDER | 'render' | Render tables and relations | Yiisoft\Yii\Cycle\Schema\SchemaConveyorInterface |
| STAGE_USERLAND | 'userland' | Userland scripts | Yiisoft\Yii\Cycle\Schema\SchemaConveyorInterface |
Property Details
protected array $conveyor = [
self::STAGE_INDEX => [
\Cycle\Schema\Generator\ResetTables::class,
],
self::STAGE_RENDER => [
\Cycle\Schema\Generator\GenerateRelations::class,
\Cycle\Schema\Generator\GenerateModifiers::class,
\Cycle\Schema\Generator\ValidateEntities::class,
\Cycle\Schema\Generator\RenderTables::class,
\Cycle\Schema\Generator\RenderRelations::class,
\Cycle\Schema\Generator\RenderModifiers::class,
\Cycle\Schema\Generator\ForeignKeys::class,
],
self::STAGE_USERLAND => [],
self::STAGE_POSTPROCESS => [
\Cycle\Schema\Generator\GenerateTypecast::class,
],
]
self::STAGE_INDEX => [
\Cycle\Schema\Generator\ResetTables::class,
],
self::STAGE_RENDER => [
\Cycle\Schema\Generator\GenerateRelations::class,
\Cycle\Schema\Generator\GenerateModifiers::class,
\Cycle\Schema\Generator\ValidateEntities::class,
\Cycle\Schema\Generator\RenderTables::class,
\Cycle\Schema\Generator\RenderRelations::class,
\Cycle\Schema\Generator\RenderModifiers::class,
\Cycle\Schema\Generator\ForeignKeys::class,
],
self::STAGE_USERLAND => [],
self::STAGE_POSTPROCESS => [
\Cycle\Schema\Generator\GenerateTypecast::class,
],
]
Method Details
| public mixed __construct ( \Psr\Container\ContainerInterface $container ) | ||
| $container | \Psr\Container\ContainerInterface | |
public function __construct(protected ContainerInterface $container)
{
}
| public void addGenerator ( string $stage, mixed $generator ) | ||
| $stage | string | |
| $generator | mixed | |
#[\Override]
public function addGenerator(string $stage, $generator): void
{
$this->conveyor[$stage][] = $generator;
}
| public array getGenerators ( ) |
#[\Override]
public function getGenerators(): array
{
$result = [];
foreach ($this->conveyor as $group) {
foreach ($group as $generatorDefinition) {
$generator = null;
if (is_string($generatorDefinition)) {
$generator = $this->container->get($generatorDefinition);
} elseif ($generatorDefinition instanceof GeneratorInterface) {
$result[] = $generatorDefinition;
continue;
} elseif (is_object($generatorDefinition) && is_callable($generatorDefinition)) {
$generator = $generatorDefinition($this->container);
}
if ($generator instanceof GeneratorInterface) {
$result[] = $generator;
continue;
}
throw new BadGeneratorDeclarationException($generator ?? $generatorDefinition);
}
}
return $result;
}
Signup or Login in order to comment.