0 follower

Abstract Class Yiisoft\Yii\Cycle\Schema\Conveyor\SchemaConveyor

InheritanceYiisoft\Yii\Cycle\Schema\Conveyor\SchemaConveyor
ImplementsYiisoft\Yii\Cycle\Schema\SchemaConveyorInterface
SubclassesYiisoft\Yii\Cycle\Schema\Conveyor\MetadataSchemaConveyor

Protected Properties

Hide inherited properties

Property Type Description Defined By
$container \Psr\Container\ContainerInterface Yiisoft\Yii\Cycle\Schema\Conveyor\SchemaConveyor
$conveyor array Yiisoft\Yii\Cycle\Schema\Conveyor\SchemaConveyor

Constants

Hide inherited 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

Hide inherited properties

$container protected property
protected \Psr\Container\ContainerInterface $container null
$conveyor protected property
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,
    ],
]

Method Details

Hide inherited methods

__construct() public method

public mixed __construct ( \Psr\Container\ContainerInterface $container )
$container \Psr\Container\ContainerInterface

                public function __construct(protected ContainerInterface $container)
{
}

            
addGenerator() public method

public void addGenerator ( string $stage, mixed $generator )
$stage string
$generator mixed

                #[\Override]
public function addGenerator(string $stage, $generator): void
{
    $this->conveyor[$stage][] = $generator;
}

            
getGenerators() public method

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;
}