Populator
in package
Service class for populating a database using the Propel ORM.
A Populator can populate several tables using ActiveRecord classes.
Table of Contents
- $entities : mixed
- $generator : mixed
- $quantities : mixed
- __construct() : mixed
- 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.
- getConnection() : mixed
Properties
$entities
protected
mixed
$entities
= []
$generator
protected
mixed
$generator
$quantities
protected
mixed
$quantities
= []
Methods
__construct()
public
__construct(Generator $generator) : mixed
Parameters
- $generator : Generator
Return values
mixed —addEntity()
Add an order for the generation of $number records for $entity.
public
addEntity(mixed $entity, int $number[, mixed $customColumnFormatters = [] ][, mixed $customModifiers = [] ]) : mixed
Parameters
- $entity : mixed
-
A Propel ActiveRecord classname, or a \Faker\ORM\Propel2\EntityPopulator instance
- $number : int
-
The number of entities to populate
- $customColumnFormatters : mixed = []
- $customModifiers : mixed = []
Return values
mixed —execute()
Populate the database using all the Entity classes previously added.
public
execute([PropelPDO $con = null ]) : array<string|int, mixed>
Parameters
- $con : PropelPDO = null
-
A Propel connection object
Return values
array<string|int, mixed> —A list of the inserted PKs
getConnection()
protected
getConnection() : mixed