Skip to content
docsv0.1.0

EntityGenerator

Generates a Doctrine entity from the `--fields` DSL following the framework's conventions (strict types, id + uuid via {@see \Milpa\Support\UuidGenerator}, typed accessors, enum-as-string columns, ManyToOne relations). Emits one file under the plugin's `Entities/`.

EntityGenerator::__construct()

public function __construct(Milpa\DevTools\Make\FieldParser $parser = new FieldParser(), Milpa\DevTools\Make\StubRenderer $renderer = new StubRenderer()):

Parameters

Parameters of __construct()
NameTypeDescription
$parserMilpa\DevTools\Make\FieldParser
$rendererMilpa\DevTools\Make\StubRenderer

EntityGenerator::name()

public function name(): string

The `<what>` token this generator answers to: `'entity'`.

EntityGenerator::generate()

public function generate(Milpa\DevTools\Make\GenerationContext $context): Milpa\DevTools\Make\GenerationResult

Parses `--fields`, renders the entity class, and returns it paired with its `entity` verify target.

Parameters

Parameters of generate()
NameTypeDescription
$contextMilpa\DevTools\Make\GenerationContext