Populator
in package
Service class for populating a database using the Spot ORM.
Table of Contents
- $entities : mixed
- $generator : mixed
- $locator : mixed
- $quantities : mixed
- __construct() : mixed
- Populator constructor.
- addEntity() : mixed
- Add an order for the generation of $number records for $entity.
- execute() : array<string|int, mixed>
- Populate the database using all the Entity classes previously added.
Properties
$entities
protected
mixed
$entities
= []
$generator
protected
mixed
$generator
$locator
protected
mixed
$locator
$quantities
protected
mixed
$quantities
= []
Methods
__construct()
Populator constructor.
public
__construct(Generator $generator[, Locator $locator = null ]) : mixed
Parameters
- $generator : Generator
- $locator : Locator = null
Return values
mixed —addEntity()
Add an order for the generation of $number records for $entity.
public
addEntity(string $entityName, int $number[, array<string|int, mixed> $customColumnFormatters = [] ][, array<string|int, mixed> $customModifiers = [] ][, bool $useExistingData = false ]) : mixed
Parameters
- $entityName : string
-
Name of Entity object to generate
- $number : int
-
The number of entities to populate
- $customColumnFormatters : array<string|int, mixed> = []
- $customModifiers : array<string|int, mixed> = []
- $useExistingData : bool = false
-
Should we use existing rows (e.g. roles) to populate relations?
Return values
mixed —execute()
Populate the database using all the Entity classes previously added.
public
execute([Locator $locator = null ]) : array<string|int, mixed>
Parameters
- $locator : Locator = null
-
A Spot locator
Return values
array<string|int, mixed> —A list of the inserted PKs