Commit 9c92600b by Carsten Brandt

Merge pull request #3728 from umneeq/gii-codestyle-fixes

Gii codestyle fixes
parents 03efbc4c 27a9bc75
......@@ -310,7 +310,7 @@ abstract class Generator extends Model
*/
public function render($template, $params = [])
{
$view = new View;
$view = new View();
$params['generator'] = $this;
return $view->renderFile($this->getTemplatePath() . '/' . $template, $params, $this);
......
......@@ -64,8 +64,8 @@ class <?= $controllerClass ?> extends <?= StringHelper::basename($generator->bas
public function actionIndex()
{
<?php if (!empty($generator->searchModelClass)): ?>
$searchModel = new <?= isset($searchModelAlias) ? $searchModelAlias : $searchModelClass ?>;
$dataProvider = $searchModel->search(Yii::$app->request->getQueryParams());
$searchModel = new <?= isset($searchModelAlias) ? $searchModelAlias : $searchModelClass ?>();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
......@@ -101,7 +101,7 @@ class <?= $controllerClass ?> extends <?= StringHelper::basename($generator->bas
*/
public function actionCreate()
{
$model = new <?= $modelClass ?>;
$model = new <?= $modelClass ?>();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', <?= $urlParams ?>]);
......
......@@ -9,7 +9,7 @@ use yii\helpers\StringHelper;
*/
/** @var \yii\db\ActiveRecord $model */
$model = new $generator->modelClass;
$model = new $generator->modelClass();
$safeAttributes = $model->safeAttributes();
if (empty($safeAttributes)) {
$safeAttributes = $model->attributes();
......
......@@ -148,7 +148,7 @@ EOD;
public function getModelAttributes()
{
/** @var Model $model */
$model = new $this->modelClass;
$model = new $this->modelClass();
if (!empty($this->scenarioName)) {
$model->setScenario($this->scenarioName);
}
......
......@@ -14,7 +14,7 @@ echo "<?php\n";
public function action<?= Inflector::id2camel(trim(basename($generator->viewName), '_')) ?>()
{
$model = new <?= $generator->modelClass ?><?= empty($generator->scenarioName) ? "" : "(['scenario' => '{$generator->scenarioName}'])" ?>;
$model = new <?= $generator->modelClass ?><?= empty($generator->scenarioName) ? "()" : "(['scenario' => '{$generator->scenarioName}'])" ?>;
if ($model->load(Yii::$app->request->post())) {
if ($model->validate()) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment