OSDN Git Service

Откорректированы сообщения и их перевод
[invent/invent.git] / controllers / TypesController.php
index 624b66e..c5e7307 100644 (file)
@@ -40,7 +40,7 @@ class TypesController extends Controller
      {
         $result = [
             'id' => FALSE,
-            'error' => Yii::t('types', 'Types: key field "type" missing') . print_r($options, TRUE),
+            'error' => Yii::t('types', 'Types: key field "type" missing') . print_r($options, TRUE),
         ];
         if (is_array($options) && isset($options[ 'type' ]))
         {
@@ -58,12 +58,12 @@ class TypesController extends Controller
                 $model->name = $options[ 'type' ];
                 if ($model->validate() && $model->save())
                 {
-                    $result['id'] = $model[0]->id;
+                    $result['id'] = $model->id;
                     $result['error'] = '';
                 }
                 else
                 {
-                    $result['error'] = Yii::t('types', 'Failed to add entry {type}', $options) . print_r($model->errors()['name'], TRUE);
+                    $result['error'] = Yii::t('types', 'Failed to add entry "{type}": ', $options) . print_r($model->errors['name'], TRUE);
                 }
             }
         }