class FixtureBlueprint (View source)

A blueprint on how to create instances of a certain {@link DataObject} subclass.

Relies on a {@link FixtureFactory} to manage database relationships between instances, and manage the mappings between fixture identifiers and their database IDs.

Properties

static private $dependencies

Methods

__construct(string $name, string $class = null, array $defaults = array())

No description

createObject(string $identifier, array $data = null, array $fixtures = null)

No description

$this
setDefaults(array $defaults)

No description

array
getDefaults()

No description

string
getClass()

No description

$this
addCallback(string $type, callable $callback)

See class documentation.

$this
removeCallback(string $type, callable $callback)

No description

Details

__construct(string $name, string $class = null, array $defaults = array())

Parameters

string $name
string $class

Defaults to $name

array $defaults

DataObject createObject(string $identifier, array $data = null, array $fixtures = null)

Parameters

string $identifier

Unique identifier for this fixture type

array $data

Map of property names to their values.

array $fixtures

Map of fixture names to an associative array of their in-memory identifiers mapped to their database IDs. Used to look up existing fixtures which might be referenced in the $data attribute via the => notation.

Return Value

DataObject

Exceptions

Exception

$this setDefaults(array $defaults)

Parameters

array $defaults

Return Value

$this

array getDefaults()

Return Value

array

string getClass()

Return Value

string

$this addCallback(string $type, callable $callback)

See class documentation.

Parameters

string $type
callable $callback

Return Value

$this

$this removeCallback(string $type, callable $callback)

Parameters

string $type
callable $callback

Return Value

$this