FileFixtureTrait
FileFixtureTrait provides functionalities for loading data fixture from file.
Tags
Table of Contents
Properties
- $dataDirectory : string
- $dataFile : string|bool
Methods
- loadData() : array<string|int, mixed>
- Returns the fixture data.
Properties
$dataDirectory
public
string
$dataDirectory
the directory path or path alias that contains the fixture data
$dataFile
public
string|bool
$dataFile
the file path or path alias of the data file that contains the fixture data to be returned by [[getData()]]. You can set this property to be false to prevent loading any data.
Methods
loadData()
Returns the fixture data.
protected
loadData(string $file[, bool $throwException = true ]) : array<string|int, mixed>
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.
Parameters
- $file : string
-
the data file path
- $throwException : bool = true
-
whether to throw exception if fixture data file does not exist.
Tags
Return values
array<string|int, mixed> —the data to be put into the database