@@ -13,11 +13,11 @@ |
||
| 13 | 13 | |
| 14 | 14 | |
| 15 | 15 | //状态定义 |
| 16 | - const STATUS_DRAFT = 0b0;//草稿 |
|
| 17 | - const STATUS_REVIEW = 0b1;//待审核 |
|
| 18 | - const STATUS_REJECTED = 0b10;//拒绝 |
|
| 19 | - const STATUS_PUBLISHED = 0b11;//发布 |
|
| 20 | - const STATUS_ARCHIVED = 0b110;//存档 |
|
| 16 | + const STATUS_DRAFT = 0b0; //草稿 |
|
| 17 | + const STATUS_REVIEW = 0b1; //待审核 |
|
| 18 | + const STATUS_REJECTED = 0b10; //拒绝 |
|
| 19 | + const STATUS_PUBLISHED = 0b11; //发布 |
|
| 20 | + const STATUS_ARCHIVED = 0b110; //存档 |
|
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | 23 | * 是否草稿状态 |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | use <?= ltrim($generator->modelClass, '\\') ?>; |
| 34 | 34 | <?php if (!empty($generator->searchModelClass)): ?> |
| 35 | 35 | use <?= ltrim($generator->searchModelClass, '\\') . (isset($searchModelAlias) ? " as $searchModelAlias" : "") ?>; |
| 36 | -<?php else: ?> |
|
| 36 | +<?php else : ?> |
|
| 37 | 37 | use yii\data\ActiveDataProvider; |
| 38 | 38 | <?php endif; ?> |
| 39 | 39 | use <?= ltrim($generator->baseControllerClass, '\\') ?>; |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | 'searchModel' => $searchModel, |
| 75 | 75 | 'dataProvider' => $dataProvider, |
| 76 | 76 | ]); |
| 77 | -<?php else: ?> |
|
| 77 | +<?php else : ?> |
|
| 78 | 78 | $dataProvider = new ActiveDataProvider([ |
| 79 | 79 | 'query' => <?= $modelClass ?>::find(), |
| 80 | 80 | ]); |
@@ -33,9 +33,12 @@ discard block |
||
| 33 | 33 | use <?= ltrim($generator->modelClass, '\\') ?>; |
| 34 | 34 | <?php if (!empty($generator->searchModelClass)): ?> |
| 35 | 35 | use <?= ltrim($generator->searchModelClass, '\\') . (isset($searchModelAlias) ? " as $searchModelAlias" : "") ?>; |
| 36 | -<?php else: ?> |
|
| 36 | +<?php else { |
|
| 37 | + : ?> |
|
| 37 | 38 | use yii\data\ActiveDataProvider; |
| 38 | -<?php endif; ?> |
|
| 39 | +<?php endif; |
|
| 40 | +} |
|
| 41 | +?> |
|
| 39 | 42 | use <?= ltrim($generator->baseControllerClass, '\\') ?>; |
| 40 | 43 | use yii\web\NotFoundHttpException; |
| 41 | 44 | use yii\filters\VerbFilter; |
@@ -74,7 +77,8 @@ discard block |
||
| 74 | 77 | 'searchModel' => $searchModel, |
| 75 | 78 | 'dataProvider' => $dataProvider, |
| 76 | 79 | ]); |
| 77 | -<?php else: ?> |
|
| 80 | +<?php else { |
|
| 81 | + : ?> |
|
| 78 | 82 | $dataProvider = new ActiveDataProvider([ |
| 79 | 83 | 'query' => <?= $modelClass ?>::find(), |
| 80 | 84 | ]); |
@@ -82,7 +86,9 @@ discard block |
||
| 82 | 86 | return $this->render('index', [ |
| 83 | 87 | 'dataProvider' => $dataProvider, |
| 84 | 88 | ]); |
| 85 | -<?php endif; ?> |
|
| 89 | +<?php endif; |
|
| 90 | +} |
|
| 91 | +?> |
|
| 86 | 92 | } |
| 87 | 93 | |
| 88 | 94 | /** |
@@ -263,7 +263,7 @@ |
||
| 263 | 263 | $dropDownOptions[$enumValue] = Inflector::humanize($enumValue); |
| 264 | 264 | } |
| 265 | 265 | return "\$form->field(\$model, '$attribute')->dropDownList(" |
| 266 | - . preg_replace("/\n\s*/", ' ', VarDumper::export($dropDownOptions)).", ['prompt' => ''])"; |
|
| 266 | + . preg_replace("/\n\s*/", ' ', VarDumper::export($dropDownOptions)) . ", ['prompt' => ''])"; |
|
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | if ($column->phpType !== 'string' || $column->size === null) { |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | * This is the model class for table "<?= $generator->generateTableName($tableName) ?>". |
| 26 | 26 | * |
| 27 | 27 | <?php foreach ($properties as $property => $data): ?> |
| 28 | - * @property <?= "{$data['type']} \${$property}" . ($data['comment'] ? ' ' . strtr($data['comment'], ["\n" => ' ']) : '') . "\n" ?> |
|
| 28 | + * @property <?= "{$data['type']} \${$property}" . ($data['comment'] ? ' ' . strtr($data['comment'], ["\n" => ' ']) : '') . "\n" ?> |
|
| 29 | 29 | <?php endforeach; ?> |
| 30 | 30 | <?php if (!empty($relations)): ?> |
| 31 | 31 | * |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | { |
| 69 | 69 | return array_merge(parent::rules(), [ |
| 70 | 70 | [['db', 'ns', 'tableName', 'modelClass', 'baseClass', 'queryNs', 'queryClass', 'queryBaseClass'], 'filter', 'filter' => 'trim'], |
| 71 | - [['ns', 'queryNs'], 'filter', 'filter' => function ($value) { return trim($value, '\\'); }], |
|
| 71 | + [['ns', 'queryNs'], 'filter', 'filter' => function($value) { return trim($value, '\\'); }], |
|
| 72 | 72 | |
| 73 | 73 | [['db', 'ns', 'tableName', 'baseClass', 'queryNs', 'queryBaseClass'], 'required'], |
| 74 | 74 | [['db', 'modelClass', 'queryClass'], 'match', 'pattern' => '/^\w+$/', 'message' => 'Only word characters are allowed.'], |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | $db = $this->getDbConnection(); |
| 158 | 158 | if ($db !== null) { |
| 159 | 159 | return [ |
| 160 | - 'tableName' => function () use ($db) { |
|
| 160 | + 'tableName' => function() use ($db) { |
|
| 161 | 161 | return $db->getSchema()->getTableNames(); |
| 162 | 162 | }, |
| 163 | 163 | ]; |
@@ -577,10 +577,10 @@ discard block |
||
| 577 | 577 | |
| 578 | 578 | $relations[$table->fullName][$leftRelationName][0] = |
| 579 | 579 | rtrim($relations[$table->fullName][$leftRelationName][0], ';') |
| 580 | - . "->inverseOf('".lcfirst($rightRelationName)."');"; |
|
| 580 | + . "->inverseOf('" . lcfirst($rightRelationName) . "');"; |
|
| 581 | 581 | $relations[$refTableSchema->fullName][$rightRelationName][0] = |
| 582 | 582 | rtrim($relations[$refTableSchema->fullName][$rightRelationName][0], ';') |
| 583 | - . "->inverseOf('".lcfirst($leftRelationName)."');"; |
|
| 583 | + . "->inverseOf('" . lcfirst($leftRelationName) . "');"; |
|
| 584 | 584 | } |
| 585 | 585 | } |
| 586 | 586 | } |
@@ -874,7 +874,7 @@ discard block |
||
| 874 | 874 | } |
| 875 | 875 | } |
| 876 | 876 | |
| 877 | - return $this->classNames[$fullTableName] = Inflector::id2camel($schemaName.$className, '_'); |
|
| 877 | + return $this->classNames[$fullTableName] = Inflector::id2camel($schemaName . $className, '_'); |
|
| 878 | 878 | } |
| 879 | 879 | |
| 880 | 880 | /** |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | use <?= ltrim($generator->modelClass, '\\') ?>; |
| 34 | 34 | <?php if (!empty($generator->searchModelClass)): ?> |
| 35 | 35 | use <?= ltrim($generator->searchModelClass, '\\') . (isset($searchModelAlias) ? " as $searchModelAlias" : "") ?>; |
| 36 | -<?php else: ?> |
|
| 36 | +<?php else : ?> |
|
| 37 | 37 | use yii\data\ActiveDataProvider; |
| 38 | 38 | <?php endif; ?> |
| 39 | 39 | use <?= ltrim($generator->baseControllerClass, '\\') ?>; |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | 'searchModel' => $searchModel, |
| 75 | 75 | 'dataProvider' => $dataProvider, |
| 76 | 76 | ]); |
| 77 | -<?php else: ?> |
|
| 77 | +<?php else : ?> |
|
| 78 | 78 | $dataProvider = new ActiveDataProvider([ |
| 79 | 79 | 'query' => <?= $modelClass ?>::find(), |
| 80 | 80 | ]); |
@@ -33,9 +33,12 @@ discard block |
||
| 33 | 33 | use <?= ltrim($generator->modelClass, '\\') ?>; |
| 34 | 34 | <?php if (!empty($generator->searchModelClass)): ?> |
| 35 | 35 | use <?= ltrim($generator->searchModelClass, '\\') . (isset($searchModelAlias) ? " as $searchModelAlias" : "") ?>; |
| 36 | -<?php else: ?> |
|
| 36 | +<?php else { |
|
| 37 | + : ?> |
|
| 37 | 38 | use yii\data\ActiveDataProvider; |
| 38 | -<?php endif; ?> |
|
| 39 | +<?php endif; |
|
| 40 | +} |
|
| 41 | +?> |
|
| 39 | 42 | use <?= ltrim($generator->baseControllerClass, '\\') ?>; |
| 40 | 43 | use yii\web\NotFoundHttpException; |
| 41 | 44 | use yii\filters\VerbFilter; |
@@ -74,7 +77,8 @@ discard block |
||
| 74 | 77 | 'searchModel' => $searchModel, |
| 75 | 78 | 'dataProvider' => $dataProvider, |
| 76 | 79 | ]); |
| 77 | -<?php else: ?> |
|
| 80 | +<?php else { |
|
| 81 | + : ?> |
|
| 78 | 82 | $dataProvider = new ActiveDataProvider([ |
| 79 | 83 | 'query' => <?= $modelClass ?>::find(), |
| 80 | 84 | ]); |
@@ -82,7 +86,9 @@ discard block |
||
| 82 | 86 | return $this->render('index', [ |
| 83 | 87 | 'dataProvider' => $dataProvider, |
| 84 | 88 | ]); |
| 85 | -<?php endif; ?> |
|
| 89 | +<?php endif; |
|
| 90 | +} |
|
| 91 | +?> |
|
| 86 | 92 | } |
| 87 | 93 | |
| 88 | 94 | /** |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | |
| 28 | 28 | <h1><?= "<?= " ?>Html::encode($this->title) ?></h1> |
| 29 | 29 | <?= $generator->enablePjax ? " <?php Pjax::begin(); ?>\n" : '' ?> |
| 30 | -<?php if(!empty($generator->searchModelClass)): ?> |
|
| 30 | +<?php if (!empty($generator->searchModelClass)): ?> |
|
| 31 | 31 | <?= " <?php " . ($generator->indexWidgetType === 'grid' ? "// " : "") ?>echo $this->render('_search', ['model' => $searchModel]); ?> |
| 32 | 32 | <?php endif; ?> |
| 33 | 33 | |
@@ -66,7 +66,8 @@ discard block |
||
| 66 | 66 | ['class' => 'yii\grid\ActionColumn'], |
| 67 | 67 | ], |
| 68 | 68 | ]); ?> |
| 69 | -<?php else: ?> |
|
| 69 | +<?php else { |
|
| 70 | + : ?> |
|
| 70 | 71 | <?= "<?= " ?>ListView::widget([ |
| 71 | 72 | 'dataProvider' => $dataProvider, |
| 72 | 73 | 'itemOptions' => ['class' => 'item'], |
@@ -74,6 +75,8 @@ discard block |
||
| 74 | 75 | return Html::a(Html::encode($model-><?= $nameAttribute ?>), ['view', <?= $urlParams ?>]); |
| 75 | 76 | }, |
| 76 | 77 | ]) ?> |
| 77 | -<?php endif; ?> |
|
| 78 | +<?php endif; |
|
| 79 | +} |
|
| 80 | +?> |
|
| 78 | 81 | <?= $generator->enablePjax ? " <?php Pjax::end(); ?>\n" : '' ?> |
| 79 | 82 | </div> |
@@ -263,7 +263,7 @@ |
||
| 263 | 263 | $dropDownOptions[$enumValue] = Inflector::humanize($enumValue); |
| 264 | 264 | } |
| 265 | 265 | return "\$form->field(\$model, '$attribute')->dropDownList(" |
| 266 | - . preg_replace("/\n\s*/", ' ', VarDumper::export($dropDownOptions)).", ['prompt' => ''])"; |
|
| 266 | + . preg_replace("/\n\s*/", ' ', VarDumper::export($dropDownOptions)) . ", ['prompt' => ''])"; |
|
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | if ($column->phpType !== 'string' || $column->size === null) { |