PHP Класс yii\console\controllers\FixtureController

#load fixtures from UsersFixture class with default namespace "tests\unit\fixtures" yii fixture/load User #also a short version of this command (generate action is default) yii fixture User #load all fixtures yii fixture "*" #load all fixtures except User yii fixture "*, -User" #load fixtures with different namespace. yii fixture/load User --namespace=alias\my\custom\namespace\goes\here The unload sub-command can be used similarly to unload fixtures.
С версии: 2.0
Автор: Mark Jebri ([email protected])
Наследование: extends yii\console\Controller, use trait yii\test\FixtureTrait
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$defaultAction controller default action ID.
$globalFixtures global fixtures that should be applied when loading and unloading. By default it is set to InitDbFixture that disables and enables integrity check, so your data can be safely loaded.
$namespace default namespace to search fixtures in

Открытые методы

Метод Описание
actionLoad ( array $fixturesInput = [] ) : integer Loads the specified fixture data.
actionUnload ( array $fixturesInput = [] ) : integer Unloads the specified fixtures.
needToApplyAll ( string $fixture ) : boolean Checks if needed to apply all fixtures.
notifyNothingToLoad ( array $foundFixtures, array $except ) Notifies user that there are no fixtures to load according input conditions
notifyNothingToUnload ( array $foundFixtures, array $except ) Notifies user that there are no fixtures to unload according input conditions
optionAliases ( )
options ( $actionID )

Приватные методы

Метод Описание
confirmLoad ( array $fixtures, array $except ) : boolean Prompts user with confirmation if fixtures should be loaded.
confirmUnload ( array $fixtures, array $except ) : boolean Prompts user with confirmation for fixtures that should be unloaded.
filterFixtures ( array $fixtures ) : array Filters fixtures by splitting them in two categories: one that should be applied and not.
findFixtures ( array $fixtures = [] ) : array Finds fixtures to be loaded, for example "User", if no fixtures were specified then all of them will be searching by suffix "Fixture.php".
getFixturePath ( ) : string Returns fixture path that determined on fixtures namespace.
getFixturesConfig ( array $fixtures ) : array Returns valid fixtures config that can be used to load them.
notifyLoaded ( array $fixtures ) Notifies user that fixtures were successfully loaded.
notifyNotFound ( array $fixtures ) Notifies user that fixtures were not found under fixtures path.
notifyUnloaded ( array $fixtures ) Notifies user that fixtures were successfully unloaded.
outputList ( array $data ) Outputs data to the console as a list.

Описание методов

actionLoad() публичный Метод

For example, # load the fixture data specified by User and UserProfile. # any existing fixture data will be removed first yii fixture/load "User, UserProfile" # load all available fixtures found under 'tests\unit\fixtures' yii fixture/load "*" # load all fixtures except User and UserProfile yii fixture/load "*, -User, -UserProfile"
public actionLoad ( array $fixturesInput = [] ) : integer
$fixturesInput array
Результат integer return code

actionUnload() публичный Метод

For example, # unload the fixture data specified by User and UserProfile. yii fixture/unload "User, UserProfile" # unload all fixtures found under 'tests\unit\fixtures' yii fixture/unload "*" # unload all fixtures except User and UserProfile yii fixture/unload "*, -User, -UserProfile"
public actionUnload ( array $fixturesInput = [] ) : integer
$fixturesInput array
Результат integer return code

needToApplyAll() публичный Метод

Checks if needed to apply all fixtures.
public needToApplyAll ( string $fixture ) : boolean
$fixture string
Результат boolean

notifyNothingToLoad() публичный Метод

Notifies user that there are no fixtures to load according input conditions
public notifyNothingToLoad ( array $foundFixtures, array $except )
$foundFixtures array array of found fixtures
$except array array of names of fixtures that should not be loaded

notifyNothingToUnload() публичный Метод

Notifies user that there are no fixtures to unload according input conditions
public notifyNothingToUnload ( array $foundFixtures, array $except )
$foundFixtures array array of found fixtures
$except array array of names of fixtures that should not be loaded

optionAliases() публичный Метод

С версии: 2.0.8
public optionAliases ( )

options() публичный Метод

public options ( $actionID )

Описание свойств

$defaultAction публичное свойство

controller default action ID.
public $defaultAction

$globalFixtures публичное свойство

global fixtures that should be applied when loading and unloading. By default it is set to InitDbFixture that disables and enables integrity check, so your data can be safely loaded.
public $globalFixtures

$namespace публичное свойство

default namespace to search fixtures in
public $namespace