PHP Class FactoryGirl\Provider\Doctrine\FieldDef

Show file Open project: breerly/factory-girl-php Class Usage Examples

Public Methods

Method Description
future ( )
past ( )
reference ( string $name ) : callable Defines a field to get() a named entity from the factory.
sequence ( callable | string $funcOrString, integer $firstNum = 1 ) : callable Defines a field to be a string based on an incrementing integer.

Method Details

future() public static method

public static future ( )

past() public static method

public static past ( )

reference() public static method

The normal semantics of get() apply. Normally this means that the field gets a fresh instance of the named entity. If a singleton has been defined, get() will return that.
public static reference ( string $name ) : callable
$name string The name of the entity to get.
return callable

sequence() public static method

This is typically used to generate unique names such as usernames. The parameter may be a function that receives a counter value each time the entity is created or it may be a string. If the parameter is a string string containing "%d" then it will be replaced by the counter value. If the string does not contain "%d" then the number is simply appended to the parameter.
public static sequence ( callable | string $funcOrString, integer $firstNum = 1 ) : callable
$funcOrString callable | string The function or pattern to generate a value from.
$firstNum integer The first number to use.
return callable