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 ExitCode::OK;
        }

        $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 ExitCode::OK;
        }

        if (!$this->confirmLoad($fixturesToLoad, $except)) {
            return ExitCode::OK;
        }

        $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 ExitCode::OK;
    }
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 ExitCode::OK;
        }

        $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 ExitCode::OK;
        }

        if (!$this->confirmLoad($fixturesToLoad, $except)) {
            return ExitCode::OK;
        }

        $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 ExitCode::OK;
    }
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 ExitCode :: OK ; } $ 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 ExitCode :: OK ; } if ( ! $ this -> confirmLoad ( $ fixturesToLoad , $ except ) ) { return ExitCode :: OK ; } $ 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 ExitCode :: OK ; }
Loads the specified fixture data.

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"
```

@param array $fixturesInput
@return int return code
@throws Exception if the specified fixture does not exist.
Loads the specified fixture data .