Skip to content
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

Merged
merged 6 commits into from
Jul 11, 2018
Merged

Conversation

tafid
Copy link
Member

@tafid tafid commented Jul 11, 2018

No description provided.

'collection' => [
'class' => Collection::class,
'model' => new ServerForm(),
'scenario' => 'create',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Лишнее, вот тут это должно делаться по умолчанию

'collection' => [
'class' => Collection::class,
'model' => new ServerForm(),
'scenario' => 'update',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Лишнее, вот тут это должно делаться по умолчанию

'model' => new ServerForm(),
'scenario' => 'create',
],
'data' => function (Action $action, array $data) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Лучше доработать SmartCreateAction чтобы он по умолчанию добывал модель из коллекции – тогда весь этот код можно удалить

'class' => ValidateFormAction::class,
'collection' => [
'class' => Collection::class,
'model' => Yii::createObject(['class' => ServerForm::class]),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yii::createObject тут не нужен. new будет достаточно

use hipanel\modules\server\validators\MacValidator;
use yii\helpers\ArrayHelper;

class ServerForm extends Server
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PHPDoc


class ServerForm extends Server
{
use \hipanel\base\ModelTrait;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Родитель уже имеет ModelTrait

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

без этого не работает

]);
}

public function getTypeOptions()
Copy link
Member

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;

Copy link
Member

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;

?>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PHPDocs?


use yii\helpers\Html;

$this->title = Yii::t('hipanel', 'Update');
Copy link
Member

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 */
Copy link
Member

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

@SilverFire SilverFire merged commit bee9670 into hiqdev:master Jul 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants