public function actionGenerate()
    {
        $templatesInput = func_get_args();

        if (empty($templatesInput)) {
            throw new Exception('You should specify input fixtures template files');
        }

        $foundTemplates = $this->findTemplatesFiles($templatesInput);

        $notFoundTemplates = array_diff($templatesInput, $foundTemplates);

        if ($notFoundTemplates) {
            $this->notifyNotFoundTemplates($notFoundTemplates);
        }

        if (!$foundTemplates) {
            $this->notifyNoTemplatesFound();
            return static::EXIT_CODE_NORMAL;
        }

        if (!$this->confirmGeneration($foundTemplates)) {
            return static::EXIT_CODE_NORMAL;
        }

        $templatePath = Yii::getAlias($this->templatePath);
        $fixtureDataPath = Yii::getAlias($this->fixtureDataPath);

        FileHelper::createDirectory($fixtureDataPath);

        $generatedTemplates = [];

        foreach ($foundTemplates as $templateName) {
            $this->generateFixtureFile($templateName, $templatePath, $fixtureDataPath);
            $generatedTemplates[] = $templateName;
        }

        $this->notifyTemplatesGenerated($generatedTemplates);
    }
public function actionGenerate()
    {
        $templatesInput = func_get_args();

        if (empty($templatesInput)) {
            throw new Exception('You should specify input fixtures template files');
        }

        $foundTemplates = $this->findTemplatesFiles($templatesInput);

        $notFoundTemplates = array_diff($templatesInput, $foundTemplates);

        if ($notFoundTemplates) {
            $this->notifyNotFoundTemplates($notFoundTemplates);
        }

        if (!$foundTemplates) {
            $this->notifyNoTemplatesFound();
            return static::EXIT_CODE_NORMAL;
        }

        if (!$this->confirmGeneration($foundTemplates)) {
            return static::EXIT_CODE_NORMAL;
        }

        $templatePath = Yii::getAlias($this->templatePath);
        $fixtureDataPath = Yii::getAlias($this->fixtureDataPath);

        FileHelper::createDirectory($fixtureDataPath);

        $generatedTemplates = [];

        foreach ($foundTemplates as $templateName) {
            $this->generateFixtureFile($templateName, $templatePath, $fixtureDataPath);
            $generatedTemplates[] = $templateName;
        }

        $this->notifyTemplatesGenerated($generatedTemplates);
    }
public function actionGenerate ( ) { $ templatesInput = func_get_args ( ) ; if ( empty ( $ templatesInput ) ) { throw new Exception ( 'You should specify input fixtures template files' ) ; } $ foundTemplates = $ this -> findTemplatesFiles ( $ templatesInput ) ; $ notFoundTemplates = array_diff ( $ templatesInput , $ foundTemplates ) ; if ( $ notFoundTemplates ) { $ this -> notifyNotFoundTemplates ( $ notFoundTemplates ) ; } if ( ! $ foundTemplates ) { $ this -> notifyNoTemplatesFound ( ) ; return static :: EXIT_CODE_NORMAL ; } if ( ! $ this -> confirmGeneration ( $ foundTemplates ) ) { return static :: EXIT_CODE_NORMAL ; } $ templatePath = Yii :: getAlias ( $ this -> templatePath ) ; $ fixtureDataPath = Yii :: getAlias ( $ this -> fixtureDataPath ) ; FileHelper :: createDirectory ( $ fixtureDataPath ) ; $ generatedTemplates = [ ] ; foreach ( $ foundTemplates as $ templateName ) { $ this -> generateFixtureFile ( $ templateName , $ templatePath , $ fixtureDataPath ) ; $ generatedTemplates [ ] = $ templateName ; } $ this -> notifyTemplatesGenerated ( $ generatedTemplates ) ; }
Generates fixtures and fill them with Faker data.
For example,

```
//generate fixtures in russian language
yii fixture/generate user --count=5 --language=ru_RU

//generate several fixtures
yii fixture/generate user profile team
```

@throws \yii\base\InvalidParamException
@throws \yii\console\Exception
Generates fixtures and fill them with Faker data . For example