PHP Class yii\test\BaseActiveFixture

For more details and usage information on BaseActiveFixture, see the guide article on fixtures.
Since: 2.0
Author: Qiang Xue ([email protected])
Inheritance: extends DbFixture, implements IteratorAggregate, implements ArrayAccess, implements Countable, use trait yii\base\ArrayAccessTrait
Afficher le fichier Open project: yiisoft/yii2 Class Usage Examples

Méthodes publiques

Свойство 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 BaseActiveFixture::getData. You can set this property to be false to prevent loading any data.
$modelClass the AR model class associated with this fixture.

Méthodes publiques

Méthode Description
getModel ( string $name ) : null | ActiveRecord Returns the AR model by the specified model name.
load ( ) Loads the fixture.
unload ( )

Méthodes protégées

Méthode Description
getData ( ) : array Returns the fixture data.

Method Details

getData() protected méthode

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
Résultat array the data to be put into the database

getModel() public méthode

A model name is the key of the corresponding data row in [[data]].
public getModel ( string $name ) : null | ActiveRecord
$name string the model name.
Résultat null | yii\db\ActiveRecord the AR model, or null if the model cannot be found in the database

load() public méthode

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

unload() public méthode

public unload ( )

Property Details

$data public_oe property

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

$dataFile public_oe property

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

$modelClass public_oe property

the AR model class associated with this fixture.
public $modelClass