Commit 94ea562bb2ed7810b436d124612c435b9a6c8e49
1 parent
a17d1b25
+ редактирование каталога в админке как в semena.in.ua
Showing
10 changed files
with
141 additions
and
72 deletions
Show diff stats
backend/controllers/CatalogController.php
| @@ -85,7 +85,7 @@ class CatalogController extends Controller | @@ -85,7 +85,7 @@ class CatalogController extends Controller | ||
| 85 | { | 85 | { |
| 86 | $model = $this->findModel($id); | 86 | $model = $this->findModel($id); |
| 87 | $model_lang = CatalogLang::find() | 87 | $model_lang = CatalogLang::find() |
| 88 | - ->where(['catalog' => $id, 'lang_id' => 1]) | 88 | + ->where(['catalog_id' => $id, 'lang_id' => 1]) |
| 89 | ->one(); | 89 | ->one(); |
| 90 | 90 | ||
| 91 | if ($model->load(Yii::$app->request->post())) | 91 | if ($model->load(Yii::$app->request->post())) |
backend/models/SearchCatalog.php
| @@ -11,8 +11,12 @@ use common\models\Catalog; | @@ -11,8 +11,12 @@ use common\models\Catalog; | ||
| 11 | * SearchCatalog represents the model behind the search form about `common\models\Catalog`. | 11 | * SearchCatalog represents the model behind the search form about `common\models\Catalog`. |
| 12 | */ | 12 | */ |
| 13 | class SearchCatalog extends Catalog | 13 | class SearchCatalog extends Catalog |
| 14 | -{ | ||
| 15 | - public $title; | 14 | +{ |
| 15 | + /** | ||
| 16 | + * для поиска | ||
| 17 | + * @var $title | ||
| 18 | + */ | ||
| 19 | + var $title; | ||
| 16 | 20 | ||
| 17 | /** | 21 | /** |
| 18 | * @inheritdoc | 22 | * @inheritdoc |
| @@ -20,8 +24,7 @@ class SearchCatalog extends Catalog | @@ -20,8 +24,7 @@ class SearchCatalog extends Catalog | ||
| 20 | public function rules() | 24 | public function rules() |
| 21 | { | 25 | { |
| 22 | return [ | 26 | return [ |
| 23 | - [['id', 'parent_id', 'type', 'subtype', 'status', 'sort'], 'integer'], | ||
| 24 | - [['cover', 'options'], 'safe'], | 27 | + [['catalog_id', 'parent_id', 'status', 'sort'], 'integer'], |
| 25 | // + поиск по title | 28 | // + поиск по title |
| 26 | [['title'], 'safe'] | 29 | [['title'], 'safe'] |
| 27 | ]; | 30 | ]; |
| @@ -54,7 +57,7 @@ class SearchCatalog extends Catalog | @@ -54,7 +57,7 @@ class SearchCatalog extends Catalog | ||
| 54 | // + поиск по title | 57 | // + поиск по title |
| 55 | $dataProvider->setSort([ | 58 | $dataProvider->setSort([ |
| 56 | 'attributes' => [ | 59 | 'attributes' => [ |
| 57 | - 'id', | 60 | + 'catalog_id', |
| 58 | 'title' => [ | 61 | 'title' => [ |
| 59 | 'asc' => ['title' => SORT_ASC], | 62 | 'asc' => ['title' => SORT_ASC], |
| 60 | 'desc' => ['title' => SORT_DESC], | 63 | 'desc' => ['title' => SORT_DESC], |
| @@ -65,34 +68,31 @@ class SearchCatalog extends Catalog | @@ -65,34 +68,31 @@ class SearchCatalog extends Catalog | ||
| 65 | ]); | 68 | ]); |
| 66 | 69 | ||
| 67 | $this->load($params); | 70 | $this->load($params); |
| 71 | + | ||
| 72 | + // + поиск по title | ||
| 73 | + $query->joinWith(['relationCatalogLangPlus']); | ||
| 68 | 74 | ||
| 69 | if (!$this->validate()) | 75 | if (!$this->validate()) |
| 70 | { | 76 | { |
| 71 | // uncomment the following line if you do not want to return any records when validation fails | 77 | // uncomment the following line if you do not want to return any records when validation fails |
| 72 | // $query->where('0=1'); | 78 | // $query->where('0=1'); |
| 73 | - | ||
| 74 | - // + поиск по title | ||
| 75 | - $query->joinWith(['catalog_i18n']); | ||
| 76 | - | 79 | + |
| 77 | return $dataProvider; | 80 | return $dataProvider; |
| 78 | } | 81 | } |
| 79 | 82 | ||
| 80 | $query->andFilterWhere([ | 83 | $query->andFilterWhere([ |
| 81 | - 'id' => $this->id, | 84 | + 'catalog_id' => $this->catalog_id, |
| 82 | 'parent_id' => $this->parent_id, | 85 | 'parent_id' => $this->parent_id, |
| 83 | - 'type' => $this->type, | ||
| 84 | - 'subtype' => $this->subtype, | ||
| 85 | 'status' => $this->status, | 86 | 'status' => $this->status, |
| 86 | 'sort' => $this->sort, | 87 | 'sort' => $this->sort, |
| 87 | ]); | 88 | ]); |
| 88 | 89 | ||
| 89 | - $query->andFilterWhere(['like', 'cover', $this->cover]) | ||
| 90 | - ->andFilterWhere(['like', 'options', $this->options]); | 90 | + $query->andFilterWhere(['like', 'cover', $this->cover]); |
| 91 | 91 | ||
| 92 | // + поиск по title | 92 | // + поиск по title |
| 93 | if (! empty ($this->title)) | 93 | if (! empty ($this->title)) |
| 94 | { | 94 | { |
| 95 | - $query->joinWith(['relationTable' => function ($q) | 95 | + $query->joinWith(['relationCatalogLangPlus' => function ($q) |
| 96 | { | 96 | { |
| 97 | $q->where(['like', 'catalog_i18n.title', $this->title]); | 97 | $q->where(['like', 'catalog_i18n.title', $this->title]); |
| 98 | }]); | 98 | }]); |
backend/views/catalog/_form.php
| @@ -2,6 +2,8 @@ | @@ -2,6 +2,8 @@ | ||
| 2 | 2 | ||
| 3 | use yii\helpers\Html; | 3 | use yii\helpers\Html; |
| 4 | use yii\widgets\ActiveForm; | 4 | use yii\widgets\ActiveForm; |
| 5 | +use yii\helpers\ArrayHelper; | ||
| 6 | +use common\models\Catalog; | ||
| 5 | 7 | ||
| 6 | /* @var $this yii\web\View */ | 8 | /* @var $this yii\web\View */ |
| 7 | /* @var $model common\models\Catalog */ | 9 | /* @var $model common\models\Catalog */ |
| @@ -14,22 +16,37 @@ use yii\widgets\ActiveForm; | @@ -14,22 +16,37 @@ use yii\widgets\ActiveForm; | ||
| 14 | 16 | ||
| 15 | <?= $form->field($model, 'title')->textInput() ?> | 17 | <?= $form->field($model, 'title')->textInput() ?> |
| 16 | 18 | ||
| 17 | - <?= $form->field($model, 'parent_id')->textInput() ?> | ||
| 18 | - | ||
| 19 | - <?= $form->field($model, 'type')->textInput() ?> | ||
| 20 | - | ||
| 21 | - <?= $form->field($model, 'subtype')->textInput() ?> | 19 | + <?= $form->field($model, 'parent_id')->dropDownList( |
| 20 | + ArrayHelper::map($model->find()->all(), 'parent_id', 'title') | ||
| 21 | + ) | ||
| 22 | + ?> | ||
| 22 | 23 | ||
| 23 | <?= $form->field($model, 'cover')->textInput(['maxlength' => true]) ?> | 24 | <?= $form->field($model, 'cover')->textInput(['maxlength' => true]) ?> |
| 25 | + | ||
| 26 | + <?= $form->field($model, 'status')->dropDownList([ | ||
| 27 | + '1' => Yii::t('action', 'show'), | ||
| 28 | + '0' => Yii::t('action', 'hide'), | ||
| 29 | + ]); | ||
| 30 | + | ||
| 31 | + echo '<pre>'; | ||
| 32 | + | ||
| 33 | + $array = $model->finInfo([ | ||
| 34 | + 'catalog_id' => 1, | ||
| 35 | + 'return_one' => true, | ||
| 36 | + 'to_array' => false, | ||
| 37 | + ]); | ||
| 38 | + | ||
| 39 | + var_dump($array->relationCatalogLang2->title); | ||
| 40 | + //var_dump($array->relationCatalogLang2->title); | ||
| 41 | + | ||
| 42 | + echo '</pre>'; | ||
| 24 | 43 | ||
| 25 | - <?= $form->field($model, 'options')->textInput() ?> | ||
| 26 | - | ||
| 27 | - <?= $form->field($model, 'status')->textInput() ?> | 44 | + ?> |
| 28 | 45 | ||
| 29 | <?= $form->field($model, 'sort')->textInput() ?> | 46 | <?= $form->field($model, 'sort')->textInput() ?> |
| 30 | 47 | ||
| 31 | <div class="form-group"> | 48 | <div class="form-group"> |
| 32 | - <?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | 49 | + <?= Html::submitButton($model->isNewRecord ? Yii::t('action', 'add') : Yii::t('action', 'update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> |
| 33 | </div> | 50 | </div> |
| 34 | 51 | ||
| 35 | <?php ActiveForm::end(); ?> | 52 | <?php ActiveForm::end(); ?> |
backend/views/catalog/_search.php
| @@ -15,18 +15,12 @@ use yii\widgets\ActiveForm; | @@ -15,18 +15,12 @@ use yii\widgets\ActiveForm; | ||
| 15 | 'method' => 'get', | 15 | 'method' => 'get', |
| 16 | ]); ?> | 16 | ]); ?> |
| 17 | 17 | ||
| 18 | - <?= $form->field($model, 'id') ?> | 18 | + <?= $form->field($model, 'catalog_id') ?> |
| 19 | 19 | ||
| 20 | <?= $form->field($model, 'parent_id') ?> | 20 | <?= $form->field($model, 'parent_id') ?> |
| 21 | - | ||
| 22 | - <?= $form->field($model, 'type') ?> | ||
| 23 | - | ||
| 24 | - <?= $form->field($model, 'subtype') ?> | ||
| 25 | - | 21 | + |
| 26 | <?= $form->field($model, 'cover') ?> | 22 | <?= $form->field($model, 'cover') ?> |
| 27 | - | ||
| 28 | - <?php // echo $form->field($model, 'options') ?> | ||
| 29 | - | 23 | + |
| 30 | <?php // echo $form->field($model, 'status') ?> | 24 | <?php // echo $form->field($model, 'status') ?> |
| 31 | 25 | ||
| 32 | <?php // echo $form->field($model, 'sort') ?> | 26 | <?php // echo $form->field($model, 'sort') ?> |
backend/views/catalog/index.php
| @@ -25,12 +25,9 @@ $this->params['breadcrumbs'][] = $this->title; | @@ -25,12 +25,9 @@ $this->params['breadcrumbs'][] = $this->title; | ||
| 25 | 'columns' => [ | 25 | 'columns' => [ |
| 26 | ['class' => 'yii\grid\SerialColumn'], | 26 | ['class' => 'yii\grid\SerialColumn'], |
| 27 | 27 | ||
| 28 | - 'id', | 28 | + 'catalog_id', |
| 29 | 'parent_id', | 29 | 'parent_id', |
| 30 | - 'title', | ||
| 31 | - 'type', | ||
| 32 | - 'subtype', | ||
| 33 | - // 'options', | 30 | + 'title', |
| 34 | // 'status', | 31 | // 'status', |
| 35 | // 'sort', | 32 | // 'sort', |
| 36 | 33 |
backend/views/catalog/update.php
| @@ -7,9 +7,9 @@ use yii\helpers\Html; | @@ -7,9 +7,9 @@ use yii\helpers\Html; | ||
| 7 | 7 | ||
| 8 | $this->title = Yii::t('app', 'Update {modelClass}: ', [ | 8 | $this->title = Yii::t('app', 'Update {modelClass}: ', [ |
| 9 | 'modelClass' => 'Catalog', | 9 | 'modelClass' => 'Catalog', |
| 10 | -]) . ' ' . $model->id; | 10 | +]) . ' ' . $model->catalog_id; |
| 11 | $this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Catalogs'), 'url' => ['index']]; | 11 | $this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Catalogs'), 'url' => ['index']]; |
| 12 | -$this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]]; | 12 | +$this->params['breadcrumbs'][] = ['label' => $model->catalog_id, 'url' => ['view', 'id' => $model->catalog_id]]; |
| 13 | $this->params['breadcrumbs'][] = Yii::t('app', 'Update'); | 13 | $this->params['breadcrumbs'][] = Yii::t('app', 'Update'); |
| 14 | ?> | 14 | ?> |
| 15 | <div class="catalog-update"> | 15 | <div class="catalog-update"> |
backend/views/catalog/view.php
| @@ -6,7 +6,7 @@ use yii\widgets\DetailView; | @@ -6,7 +6,7 @@ use yii\widgets\DetailView; | ||
| 6 | /* @var $this yii\web\View */ | 6 | /* @var $this yii\web\View */ |
| 7 | /* @var $model common\models\Catalog */ | 7 | /* @var $model common\models\Catalog */ |
| 8 | 8 | ||
| 9 | -$this->title = $model->id; | 9 | +$this->title = $model->catalog_id; |
| 10 | $this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Catalogs'), 'url' => ['index']]; | 10 | $this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Catalogs'), 'url' => ['index']]; |
| 11 | $this->params['breadcrumbs'][] = $this->title; | 11 | $this->params['breadcrumbs'][] = $this->title; |
| 12 | ?> | 12 | ?> |
| @@ -15,8 +15,8 @@ $this->params['breadcrumbs'][] = $this->title; | @@ -15,8 +15,8 @@ $this->params['breadcrumbs'][] = $this->title; | ||
| 15 | <h1><?= Html::encode($this->title) ?></h1> | 15 | <h1><?= Html::encode($this->title) ?></h1> |
| 16 | 16 | ||
| 17 | <p> | 17 | <p> |
| 18 | - <?= Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?> | ||
| 19 | - <?= Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->id], [ | 18 | + <?= Html::a(Yii::t('app', 'Update'), ['update', 'catalog_id' => $model->catalog_id], ['class' => 'btn btn-primary']) ?> |
| 19 | + <?= Html::a(Yii::t('app', 'Delete'), ['delete', 'catalog_id' => $model->catalog_id], [ | ||
| 20 | 'class' => 'btn btn-danger', | 20 | 'class' => 'btn btn-danger', |
| 21 | 'data' => [ | 21 | 'data' => [ |
| 22 | 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'), | 22 | 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'), |
| @@ -28,12 +28,9 @@ $this->params['breadcrumbs'][] = $this->title; | @@ -28,12 +28,9 @@ $this->params['breadcrumbs'][] = $this->title; | ||
| 28 | <?= DetailView::widget([ | 28 | <?= DetailView::widget([ |
| 29 | 'model' => $model, | 29 | 'model' => $model, |
| 30 | 'attributes' => [ | 30 | 'attributes' => [ |
| 31 | - 'id', | ||
| 32 | - 'parent_id', | ||
| 33 | - 'type', | ||
| 34 | - 'subtype', | ||
| 35 | - 'cover', | ||
| 36 | - 'options', | 31 | + 'catalog_id', |
| 32 | + 'parent_id', | ||
| 33 | + 'cover', | ||
| 37 | 'status', | 34 | 'status', |
| 38 | 'sort', | 35 | 'sort', |
| 39 | ], | 36 | ], |
common/models/Catalog.php
| @@ -3,21 +3,20 @@ | @@ -3,21 +3,20 @@ | ||
| 3 | namespace common\models; | 3 | namespace common\models; |
| 4 | 4 | ||
| 5 | use Yii; | 5 | use Yii; |
| 6 | +use yii\data\ActiveDataProvider; | ||
| 6 | 7 | ||
| 7 | /** | 8 | /** |
| 8 | * This is the model class for table "catalog". | 9 | * This is the model class for table "catalog". |
| 9 | * | 10 | * |
| 10 | * @property integer $id | 11 | * @property integer $id |
| 11 | - * @property integer $parent_id | ||
| 12 | - * @property integer $type | ||
| 13 | - * @property integer $subtype | 12 | + * @property integer $parent_id |
| 14 | * @property string $cover | 13 | * @property string $cover |
| 15 | * @property string $options | 14 | * @property string $options |
| 16 | * @property integer $status | 15 | * @property integer $status |
| 17 | * @property integer $sort | 16 | * @property integer $sort |
| 18 | */ | 17 | */ |
| 19 | class Catalog extends \yii\db\ActiveRecord | 18 | class Catalog extends \yii\db\ActiveRecord |
| 20 | -{ | 19 | +{ |
| 21 | /** | 20 | /** |
| 22 | * @inheritdoc | 21 | * @inheritdoc |
| 23 | */ | 22 | */ |
| @@ -32,40 +31,105 @@ class Catalog extends \yii\db\ActiveRecord | @@ -32,40 +31,105 @@ class Catalog extends \yii\db\ActiveRecord | ||
| 32 | public function rules() | 31 | public function rules() |
| 33 | { | 32 | { |
| 34 | return [ | 33 | return [ |
| 35 | - [['parent_id', 'type', 'subtype', 'status', 'sort'], 'integer'], | ||
| 36 | - [['options'], 'string'], | 34 | + [['parent_id', 'status', 'sort'], 'integer'], |
| 37 | [['cover'], 'string', 'max' => 32], | 35 | [['cover'], 'string', 'max' => 32], |
| 38 | ]; | 36 | ]; |
| 39 | } | 37 | } |
| 40 | - | 38 | + |
| 41 | /** | 39 | /** |
| 42 | * @inheritdoc | 40 | * @inheritdoc |
| 43 | */ | 41 | */ |
| 44 | public function attributeLabels() | 42 | public function attributeLabels() |
| 45 | { | 43 | { |
| 46 | return [ | 44 | return [ |
| 47 | - 'id' => Yii::t('app', 'ID'), | 45 | + 'catalog_id' => Yii::t('app', 'ID'), |
| 48 | 'parent_id' => Yii::t('app', 'Parent ID'), | 46 | 'parent_id' => Yii::t('app', 'Parent ID'), |
| 49 | - 'type' => Yii::t('app', 'Type'), | ||
| 50 | - 'subtype' => Yii::t('app', 'Subtype'), | ||
| 51 | - 'cover' => Yii::t('app', 'Cover'), | ||
| 52 | - 'options' => Yii::t('app', 'Options'), | 47 | + 'cover' => Yii::t('app', 'Cover'), |
| 53 | 'status' => Yii::t('app', 'Status'), | 48 | 'status' => Yii::t('app', 'Status'), |
| 54 | 'sort' => Yii::t('app', 'Sort'), | 49 | 'sort' => Yii::t('app', 'Sort'), |
| 55 | ]; | 50 | ]; |
| 56 | } | 51 | } |
| 52 | + | ||
| 53 | + /** | ||
| 54 | + * Выполняет поис по параметрам | ||
| 55 | + * @param array $param принимает [catalog_id, lang_id, return_one, return_field, show_all] | ||
| 56 | + * @return array one | array all | string значение масива | ||
| 57 | + */ | ||
| 58 | + public function finInfo (array $params = []) | ||
| 59 | + { | ||
| 60 | + Tools::ifNotExist ($params, array ( | ||
| 61 | + 'catalog_id' => false, | ||
| 62 | + 'lang_id' => false, | ||
| 63 | + 'return_one' => false, | ||
| 64 | + 'return_field' => false, | ||
| 65 | + 'show_all' => false, | ||
| 66 | + 'to_array' => true, | ||
| 67 | + )); | ||
| 68 | + | ||
| 69 | + $model = new Catalog(); | ||
| 70 | + | ||
| 71 | + $query = $model->find()->select('*'); | ||
| 72 | + | ||
| 73 | + $query->joinWith(['relationCatalogLang2']); | ||
| 74 | + | ||
| 75 | + $WHERE = array (); | ||
| 76 | + | ||
| 77 | + if ($params['catalog_id'] !== false) | ||
| 78 | + { | ||
| 79 | + $WHERE['catalog.catalog_id'] = $params['catalog_id']; | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + if ($params['lang_id'] !== false) | ||
| 83 | + { | ||
| 84 | + $WHERE['catalog_i18n.lang_id'] = $params['lang_id']; | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + if (! empty ($WHERE)) | ||
| 88 | + { | ||
| 89 | + $query->where($WHERE); | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | + if ($params['to_array'] !== false) | ||
| 93 | + { | ||
| 94 | + $query = $query->asArray(); | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + if ($params['return_one'] !== false || $params['return_field'] !== false) | ||
| 98 | + { | ||
| 99 | + | ||
| 100 | + $result = $params['return_field'] !== false ? $query->one($params['return_field']) : $query->one(); | ||
| 101 | + } | ||
| 102 | + else | ||
| 103 | + { | ||
| 104 | + $result = $query->all(); | ||
| 105 | + } | ||
| 106 | + | ||
| 107 | + return $result; | ||
| 108 | + } | ||
| 57 | 109 | ||
| 58 | /** | 110 | /** |
| 59 | * @return \yii\db\ActiveQuery | 111 | * @return \yii\db\ActiveQuery |
| 60 | */ | 112 | */ |
| 61 | - public function getRelationTable() | 113 | + public function getRelationCatalogLangPlus() |
| 114 | + { | ||
| 115 | + return $this->getRelationCatalogLang2()->where(['lang_id' => yii::$app->params['lang_id']]); | ||
| 116 | + } | ||
| 117 | + | ||
| 118 | + /** | ||
| 119 | + * @return \yii\db\ActiveQuery | ||
| 120 | + */ | ||
| 121 | + public function getRelationCatalogLang2() | ||
| 62 | { | 122 | { |
| 63 | - return $this->hasOne(CatalogLang::className(), ['catalog' => 'id']); | 123 | + return $this->hasOne(CatalogLang::className(), ['catalog_id' => 'catalog_id']); |
| 64 | } | 124 | } |
| 65 | - | 125 | + |
| 66 | public function getTitle() | 126 | public function getTitle() |
| 67 | { | 127 | { |
| 68 | - return $this->relationTable->title; | 128 | + return $this->relationCatalogLangPlus->title; |
| 129 | + } | ||
| 130 | + | ||
| 131 | + public function getParentTitle() | ||
| 132 | + { | ||
| 133 | + return $this->relationCatalogLangPlus->title; | ||
| 69 | } | 134 | } |
| 70 | - | ||
| 71 | } | 135 | } |
common/models/CatalogLang.php
| @@ -7,7 +7,7 @@ use Yii; | @@ -7,7 +7,7 @@ use Yii; | ||
| 7 | /** | 7 | /** |
| 8 | * This is the model class for table "catalog_i18n". | 8 | * This is the model class for table "catalog_i18n". |
| 9 | * | 9 | * |
| 10 | - * @property integer $catalog | 10 | + * @property integer $catalog_id |
| 11 | * @property integer $lang_id | 11 | * @property integer $lang_id |
| 12 | * @property string $title | 12 | * @property string $title |
| 13 | * @property string $alias | 13 | * @property string $alias |
| @@ -32,8 +32,8 @@ class CatalogLang extends \yii\db\ActiveRecord | @@ -32,8 +32,8 @@ class CatalogLang extends \yii\db\ActiveRecord | ||
| 32 | public function rules() | 32 | public function rules() |
| 33 | { | 33 | { |
| 34 | return [ | 34 | return [ |
| 35 | - [['catalog', 'lang_id', 'title', 'alias'], 'required'], | ||
| 36 | - [['catalog', 'lang_id'], 'integer'], | 35 | + [['catalog_id', 'lang_id', 'title', 'alias'], 'required'], |
| 36 | + [['catalog_id', 'lang_id'], 'integer'], | ||
| 37 | [['title'], 'string', 'max' => 1024], | 37 | [['title'], 'string', 'max' => 1024], |
| 38 | [['alias'], 'string', 'max' => 128], | 38 | [['alias'], 'string', 'max' => 128], |
| 39 | [['meta_title', 'meta_keywords', 'meta_description', 'full_alias'], 'string', 'max' => 255], | 39 | [['meta_title', 'meta_keywords', 'meta_description', 'full_alias'], 'string', 'max' => 255], |
| @@ -47,7 +47,7 @@ class CatalogLang extends \yii\db\ActiveRecord | @@ -47,7 +47,7 @@ class CatalogLang extends \yii\db\ActiveRecord | ||
| 47 | public function attributeLabels() | 47 | public function attributeLabels() |
| 48 | { | 48 | { |
| 49 | return [ | 49 | return [ |
| 50 | - 'catalog' => Yii::t('app', 'Catalog'), | 50 | + 'catalog_id' => Yii::t('app', 'catalog_id'), |
| 51 | 'lang_id' => Yii::t('app', 'Lang ID'), | 51 | 'lang_id' => Yii::t('app', 'Lang ID'), |
| 52 | 'title' => Yii::t('app', 'Title'), | 52 | 'title' => Yii::t('app', 'Title'), |
| 53 | 'alias' => Yii::t('app', 'Alias'), | 53 | 'alias' => Yii::t('app', 'Alias'), |
common/translation/ru/action.php