yii\console\controllers\FixtureController::actionLoad PHP Method

actionLoad() public method

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
return integer return code
    public function actionLoad(array $fixturesInput = [])
    {
        if ($fixturesInput === []) {
            $this->stdout($this->getHelpSummary() . "\n");
            $helpCommand = Console::ansiFormat('yii help fixture', [Console::FG_CYAN]);
            $this->stdout("Use {$helpCommand} to get usage info.\n");
            return self::EXIT_CODE_NORMAL;
        }
        $filtered = $this->filterFixtures($fixturesInput);
        $except = $filtered['except'];
        if (!$this->needToApplyAll($fixturesInput[0])) {
            $fixtures = $filtered['apply'];
            $foundFixtures = $this->findFixtures($fixtures);
            $notFoundFixtures = array_diff($fixtures, $foundFixtures);
            if ($notFoundFixtures) {
                $this->notifyNotFound($notFoundFixtures);
            }
        } else {
            $foundFixtures = $this->findFixtures();
        }
        $fixturesToLoad = array_diff($foundFixtures, $except);
        if (!$foundFixtures) {
            throw new Exception("No files were found for: \"" . implode(', ', $fixturesInput) . "\".\n" . "Check that files exist under fixtures path: \n\"" . $this->getFixturePath() . "\".");
        }
        if (!$fixturesToLoad) {
            $this->notifyNothingToLoad($foundFixtures, $except);
            return static::EXIT_CODE_NORMAL;
        }
        if (!$this->confirmLoad($fixturesToLoad, $except)) {
            return static::EXIT_CODE_NORMAL;
        }
        $fixtures = $this->getFixturesConfig(array_merge($this->globalFixtures, $fixturesToLoad));
        if (!$fixtures) {
            throw new Exception('No fixtures were found in namespace: "' . $this->namespace . '"' . '');
        }
        $fixturesObjects = $this->createFixtures($fixtures);
        $this->unloadFixtures($fixturesObjects);
        $this->loadFixtures($fixturesObjects);
        $this->notifyLoaded($fixtures);
        return static::EXIT_CODE_NORMAL;
    }