final class PlanGenerator

Generates the rows a plan describes, keeping related rows consistent.

The walk starts at the table the plan is about and follows relations outwards, once per connected group of tables. Starting anywhere else changes the answer: a plan written order.id < order_detail.order_id, order.customer_id > customer.id has customer as its only dependency-free table, and beginning there would make order a collection hanging off it rather than the one row the plan is about.

Direction decides count. Walking to a child asks how many, walking to a parent asks for the one row being referenced. Both carry the collection-ness of where they came from, so a table reached through a list is a list however many rows it happens to have.

Methods§

public function __construct(
    private SchemaResolverInterface $schemas,
    private FixtureGenerator $generator,
    private Generator $faker,
)

Initializes the collaborators and declared state for this object.

Parameters

$schemasSchemaResolverInterface
$generatorFixtureGenerator
$fakerGenerator
public function generate(
    FixturePlan $plan,
    array<string, int|array<mixed>|TableOverrides> $overrides = [],
): FixtureSet

Parameters

$planFixturePlan
$overridesarray<string, int|array<mixed>|TableOverrides>Table name => what to override

Returns

Throws

GeneratedColumnReferenceException If a relation references a generated column
UnknownPlanColumnException If a relation names a column the table lacks
Test cases 31
Called from 1
Calls 13

Private surface 3§

Implementation details, listed for orientation only.

private SchemaResolverInterface $schemas
private FixtureGenerator $generator
private Generator $faker

Test cases 35§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 31
Other tests reaching this symbol 4

Relations§

Instantiated in 1
Method calls 1