PHP Class yii\test\ArrayFixture

For more details and usage information on ArrayFixture, see the guide article on fixtures.
Since: 2.0
Author: Mark Jebri ([email protected])
Inheritance: extends Fixture, implements IteratorAggregate, implements ArrayAccess, implements Countable, use trait yii\base\ArrayAccessTrait
Show file Open project: yiisoft/yii2 Class Usage Examples

Public Properties

Property Type Description
$data the data rows. Each array element represents one row of data (column name => column value).
$dataFile the file path or path alias of the data file that contains the fixture data to be returned by ArrayFixture::getData. You can set this property to be false to prevent loading any data.

Public Methods

Method Description
load ( ) Loads the fixture.
unload ( )

Protected Methods

Method Description
getData ( ) : array Returns the fixture data.

Method Details

getData() protected method

The default implementation will try to return the fixture data by including the external file specified by [[dataFile]]. The file should return the data array that will be stored in [[data]] after inserting into the database.
protected getData ( ) : array
return array the data to be put into the database

load() public method

The default implementation simply stores the data returned by ArrayFixture::getData in [[data]]. You should usually override this method by putting the data into the underlying database.
public load ( )

unload() public method

public unload ( )

Property Details

$data public property

the data rows. Each array element represents one row of data (column name => column value).
public $data

$dataFile public property

the file path or path alias of the data file that contains the fixture data to be returned by ArrayFixture::getData. You can set this property to be false to prevent loading any data.
public $dataFile