-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added "server create" functionality #25
Conversation
src/controllers/ServerController.php
Outdated
'collection' => [ | ||
'class' => Collection::class, | ||
'model' => new ServerForm(), | ||
'scenario' => 'create', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Лишнее, вот тут это должно делаться по умолчанию
src/controllers/ServerController.php
Outdated
'collection' => [ | ||
'class' => Collection::class, | ||
'model' => new ServerForm(), | ||
'scenario' => 'update', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Лишнее, вот тут это должно делаться по умолчанию
src/controllers/ServerController.php
Outdated
'model' => new ServerForm(), | ||
'scenario' => 'create', | ||
], | ||
'data' => function (Action $action, array $data) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Лучше доработать SmartCreateAction чтобы он по умолчанию добывал модель из коллекции – тогда весь этот код можно удалить
src/controllers/ServerController.php
Outdated
'class' => ValidateFormAction::class, | ||
'collection' => [ | ||
'class' => Collection::class, | ||
'model' => Yii::createObject(['class' => ServerForm::class]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yii::createObject
тут не нужен. new
будет достаточно
src/forms/ServerForm.php
Outdated
use hipanel\modules\server\validators\MacValidator; | ||
use yii\helpers\ArrayHelper; | ||
|
||
class ServerForm extends Server |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PHPDoc
src/forms/ServerForm.php
Outdated
|
||
class ServerForm extends Server | ||
{ | ||
use \hipanel\base\ModelTrait; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Родитель уже имеет ModelTrait
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
без этого не работает
src/models/Server.php
Outdated
]); | ||
} | ||
|
||
public function getTypeOptions() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Return type hinting
use hipanel\widgets\DynamicFormWidget; | ||
use yii\bootstrap\ActiveForm; | ||
use yii\bootstrap\Html; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PHPDocs?
$this->params['breadcrumbs'][] = ['label' => Yii::t('hipanel:server', 'Servers'), 'url' => ['index']]; | ||
$this->params['breadcrumbs'][] = $this->title; | ||
|
||
?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PHPDocs?
src/views/server/update.php
Outdated
|
||
use yii\helpers\Html; | ||
|
||
$this->title = Yii::t('hipanel', 'Update'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PHPDocs?
use yii\bootstrap\ActiveForm; | ||
use yii\bootstrap\Html; | ||
|
||
/** @var \hipanel\modules\server\forms\ServerForm $model */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
В идеале ещё @var \yii\web\View $this
No description provided.