public static function generateModels(array $config)
    {
        $schemas = ArrayHelper::getValue($config, 'schemas', []);
        $namespace = ArrayHelper::getValue($config, 'namespace', 'simialbi\yii2\schemaorg\models');
        $folder = ArrayHelper::getValue($config, 'folder', sprintf(
            '%1$s%2$ssimialbi%2$syii2-schema-org%2$ssrc%2$smodels',
            $config['vendorPath'],
            DIRECTORY_SEPARATOR
        ));
        $removeOld = ArrayHelper::getValue($config, 'removeOld', true);

        require_once $config['vendorPath'] . DIRECTORY_SEPARATOR . 'autoload.php';
        require_once $config['vendorPath'] . DIRECTORY_SEPARATOR . 'yiisoft' . DIRECTORY_SEPARATOR . 'yii2' . DIRECTORY_SEPARATOR . 'Yii.php';

        Yii::setAlias('@runtime', rtrim(str_replace(['\\', '/'], '/', sys_get_temp_dir()), '/'));

        new \yii\console\Application([
            'id' => 'Commmand runner',
            'basePath' => __DIR__,
            'vendorPath' => $config['vendorPath'],
            'bootstrap' => ['schema'],
            'aliases' => [],
            'modules' => [
                'schema' => [
                    'class' => 'simialbi\yii2\schemaorg\Module'
                ]
            ]
        ]);
        $options = [
            'namespace' => $namespace,
            'folder' => $folder,
            'removeOld' => $removeOld
        ];
        if (!empty($schemas)) {
            $options['schemas'] = implode(',', $schemas);
        }
        Yii::$app->runAction('schema/models/generate', $options);

        Yii::$app = null;
        unset($app);
    }
public static function generateModels(array $config)
    {
        $schemas = ArrayHelper::getValue($config, 'schemas', []);
        $namespace = ArrayHelper::getValue($config, 'namespace', 'simialbi\yii2\schemaorg\models');
        $folder = ArrayHelper::getValue($config, 'folder', sprintf(
            '%1$s%2$ssimialbi%2$syii2-schema-org%2$ssrc%2$smodels',
            $config['vendorPath'],
            DIRECTORY_SEPARATOR
        ));
        $removeOld = ArrayHelper::getValue($config, 'removeOld', true);

        require_once $config['vendorPath'] . DIRECTORY_SEPARATOR . 'autoload.php';
        require_once $config['vendorPath'] . DIRECTORY_SEPARATOR . 'yiisoft' . DIRECTORY_SEPARATOR . 'yii2' . DIRECTORY_SEPARATOR . 'Yii.php';

        Yii::setAlias('@runtime', rtrim(str_replace(['\\', '/'], '/', sys_get_temp_dir()), '/'));

        new \yii\console\Application([
            'id' => 'Commmand runner',
            'basePath' => __DIR__,
            'vendorPath' => $config['vendorPath'],
            'bootstrap' => ['schema'],
            'aliases' => [],
            'modules' => [
                'schema' => [
                    'class' => 'simialbi\yii2\schemaorg\Module'
                ]
            ]
        ]);
        $options = [
            'namespace' => $namespace,
            'folder' => $folder,
            'removeOld' => $removeOld
        ];
        if (!empty($schemas)) {
            $options['schemas'] = implode(',', $schemas);
        }
        Yii::$app->runAction('schema/models/generate', $options);

        Yii::$app = null;
        unset($app);
    }
public static function generateModels ( array $ config ) { $ schemas = ArrayHelper :: getValue ( $ config , 'schemas' , [ ] ) ; $ namespace = ArrayHelper :: getValue ( $ config , 'namespace' , 'simialbi\yii2\schemaorg\models' ) ; $ folder = ArrayHelper :: getValue ( $ config , 'folder' , sprintf ( '%1$s%2$ssimialbi%2$syii2-schema-org%2$ssrc%2$smodels' , $ config [ 'vendorPath' ] , DIRECTORY_SEPARATOR ) ) ; $ removeOld = ArrayHelper :: getValue ( $ config , 'removeOld' , true ) ; require_once $ config [ 'vendorPath' ] . DIRECTORY_SEPARATOR . 'autoload.php' ; require_once $ config [ 'vendorPath' ] . DIRECTORY_SEPARATOR . 'yiisoft' . DIRECTORY_SEPARATOR . 'yii2' . DIRECTORY_SEPARATOR . 'Yii.php' ; Yii :: setAlias ( '@runtime' , rtrim ( str_replace ( [ '\\' , '/' ] , '/' , sys_get_temp_dir ( ) ) , '/' ) ) ; new \ yii \ console \ Application ( [ 'id' => 'Commmand runner' , 'basePath' => __DIR__ , 'vendorPath' => $ config [ 'vendorPath' ] , 'bootstrap' => [ 'schema' ] , 'aliases' => [ ] , 'modules' => [ 'schema' => [ 'class' => 'simialbi\yii2\schemaorg\Module' ] ] ] ) ; $ options = [ 'namespace' => $ namespace , 'folder' => $ folder , 'removeOld' => $ removeOld ] ; if ( ! empty ( $ schemas ) ) { $ options [ 'schemas' ] = implode ( ',' , $ schemas ) ; } Yii :: $ app -> runAction ( 'schema/models/generate' , $ options ) ; Yii :: $ app = null ; unset ( $ app ) ; }
Run model generation action

@param array $config Configuration for model generation

@throws \yii\base\InvalidConfigException
@throws \yii\console\Exception
@throws \yii\base\InvalidRouteException
Run model generation action