TranslationUserLanguageMm.php 2.61 KB
Newer Older
Marcello Pivanti's avatar
Marcello Pivanti committed
1
2
3
4
5
6
<?php

/**
 * Art-ER Attrattività, ricerca e territorio dell’Emilia-Romagna
 * OPEN 2.0
 *
waltermazza's avatar
waltermazza committed
7
 * @package    arter
Marcello Pivanti's avatar
Marcello Pivanti committed
8
9
10
11
 * @category   CategoryName
 * @author     Elite Division S.r.l.
 */

waltermazza's avatar
waltermazza committed
12
namespace arter\amos\translation\models;
Marcello Pivanti's avatar
Marcello Pivanti committed
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

use Yii;

/**
 * This is the base-model class for table "translation_user_language_mm".
 *
 * @property integer $user_id
 * @property string $language
 * @property string $created_at
 * @property string $updated_at
 * @property string $deleted_at
 * @property integer $created_by
 * @property integer $updated_by
 * @property integer $deleted_by
 *
 * @property \backend\models\Language $language0
 * @property \backend\models\User $user
 */
waltermazza's avatar
waltermazza committed
31
class TranslationUserLanguageMm extends \arter\amos\core\record\Record {
Marcello Pivanti's avatar
Marcello Pivanti committed
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50

    /**
     * @inheritdoc
     */
    public static function tableName() {
        return 'translation_user_language_mm';
    }

    /**
     * @inheritdoc
     */
    public function rules() {
        return [
            [['user_id'], 'required'],
            [['user_id', 'created_by', 'updated_by', 'deleted_by'], 'integer'],
            [['created_at', 'updated_at', 'deleted_at'], 'safe'],
            [['language'], 'safe'],
            [['user_id', 'language'], 'unique', 'targetAttribute' => ['user_id', 'language']],
            [['language'], 'exist', 'skipOnError' => true, 'targetClass' => \lajax\translatemanager\models\Language::className(), 'targetAttribute' => ['language' => 'language_id']],
waltermazza's avatar
waltermazza committed
51
            [['user_id'], 'exist', 'skipOnError' => true, 'targetClass' => \arter\amos\core\user\User::className(), 'targetAttribute' => ['user_id' => 'id']],
Marcello Pivanti's avatar
Marcello Pivanti committed
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels() {
        return [
            'user_id' => Yii::t('amostranslation', 'User ID'),
            'language' => Yii::t('amostranslation', 'Language'),
            'created_at' => Yii::t('amostranslation', 'Created At'),
            'updated_at' => Yii::t('amostranslation', 'Updated At'),
            'deleted_at' => Yii::t('amostranslation', 'Deleted At'),
            'created_by' => Yii::t('amostranslation', 'Created By'),
            'updated_by' => Yii::t('amostranslation', 'Updated By'),
            'deleted_by' => Yii::t('amostranslation', 'Deleted By'),
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getLanguage0() {
        return $this->hasOne(\lajax\translatemanager\models\Language::className(), ['language_id' => 'language']);
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getUser() {
waltermazza's avatar
waltermazza committed
82
        return $this->hasOne(\arter\amos\core\user\User::className(), ['id' => 'user_id']);
Marcello Pivanti's avatar
Marcello Pivanti committed
83
84
85
    }

}