HumHub Documentation (unofficial)

FileFixtureTrait

FileFixtureTrait provides functionalities for loading data fixture from file.

Tags
author

Leandro Guindani Gehlen leandrogehlen@gmail.com

since
2.0.14

Table of Contents

Properties

$dataDirectory  : string
$dataFile  : string|bool

Methods

loadData()  : array<string|int, mixed>
Returns the fixture data.

Properties

$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
throws
InvalidConfigException

if the specified data file does not exist.

Return values
array<string|int, mixed>

the data to be put into the database


        
On this page

Search results