本文整理汇总了PHP中yii\gii\Generator::init方法的典型用法代码示例。如果您正苦于以下问题:PHP Generator::init方法的具体用法?PHP Generator::init怎么用?PHP Generator::init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\gii\Generator
的用法示例。
在下文中一共展示了Generator::init方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init()
{
parent::init();
$this->baseModel = new BaseModelGenerator(['additionName' => 'Generator[baseModel]', 'createForm' => false, 'customBehaviors' => ['trans' => ['title' => 'Multilingual behavior', 'alias' => 'trans', 'checked' => true, 'languageField' => $this->languageField ?: 'language', 'langClassSuffix' => '', 'dynamicLangClass' => false, 'requireTranslations' => false, 'abridge' => false, 'langForeignKey' => '', 'attributesLang' => 'title, body, lang', 'langClassName' => '', 'languages' => null, 'class' => 'omgdef\\multilingual\\MultilingualBehavior']], 'addUseQuery' => 'use omgdef\\multilingual\\MultilingualTrait;' . PHP_EOL, 'addTraitsQuery' => 'use MultilingualTrait;' . PHP_EOL, 'translateGenerator' => true]);
$this->translateModel = new BaseModelGenerator(['additionName' => 'Generator[translateModel]', 'createForm' => false]);
$this->translateModel->tableBuilder->fields[] = new Field(['name' => $this->languageField, 'type' => Schema::TYPE_STRING, 'length' => 50, 'is_not_null' => true, 'comment' => 'Language']);
}
示例2: init
/**
* @inheritdoc
*/
public function init()
{
parent::init();
if (Yii::getAlias('@common', false)) {
$this->baseModelClass = 'common\\models\\base\\*Base';
}
}
示例3: init
/**
* @inheritdoc
*/
public function init()
{
parent::init();
// set $migrationName on init so that it can be loaded via $_POST later on preview and generation
// if we don't set it, it will be different every time, and generator will give an error
$this->migrationName = 'm' . gmdate('ymd_His') . '_create';
}
示例4: init
/**
* @inheritdoc
*/
public function init()
{
if (!isset($this->templates['adm'])) {
$this->templates['adm'] = '@vendor/pavlinter/yii2-adm/adm/gii/generators/module/adm';
}
$this->templates['default'] = Yii::getAlias('@vendor/yiisoft/yii2-gii/generators/module/default');
parent::init();
}
示例5: init
public function init()
{
parent::init();
$this->moduleDir = $this->getModuleDir();
$this->modelClass = 'source\\modules\\' . $this->moduleDir . '\\models\\';
$this->searchModelClass = 'source\\modules\\' . $this->moduleDir . '\\models\\search\\';
$this->controllerClass = 'source\\modules\\' . $this->moduleDir . '\\admin\\controllers\\controller id Controller';
$this->viewPath = '@source/modules/' . $this->moduleDir . '/admin/views/';
}
示例6: init
/**
* @inheritdoc
*/
public function init()
{
if (!isset($this->templates['adm'])) {
$this->templates['adm'] = '@admgii/generators/crud/adm';
}
if (!isset($this->templates['frontend'])) {
$this->templates['frontend'] = '@admgii/generators/crud/frontend';
}
$this->templates['default'] = Yii::getAlias('@vendor/yiisoft/yii2-gii/generators/crud/default');
parent::init();
}
示例7: init
public function init()
{
$this->query = <<<PHP
/**
* @var string \$modelClass
*/
\$query = \$modelClass::find();
\$query->limit(20)->offset(0);
return \$query;
PHP;
parent::init();
}
示例8: init
/**
* @inheritdoc
*/
public function init()
{
parent::init();
$this->ns = \Yii::$app->controllerNamespace;
}
示例9: init
/**
* @inheritdoc
*/
public function init()
{
parent::init();
$this->migrationTime = gmdate('ymd_H0101');
}
示例10: init
/**
* @inheritdoc
*/
public function init()
{
parent::init();
$this->path = Yii::getAlias('@app') . DIRECTORY_SEPARATOR . "models";
}
示例11: init
/**
* @inheritdoc
*/
public function init()
{
$this->templates['light.default'] = __DIR__ . '/default';
parent::init();
}
示例12: Init
public function Init()
{
parent::init();
$dir = __DIR__ . '/../messages/';
Yii::$app->i18n->translations[$this->messageCategory] = ['class' => 'yii\\i18n\\PhpMessageSource', 'sourceLanguage' => 'en-US', 'basePath' => $dir];
}