<?php

namespace backend\models;

use common\models\User;
use Yii;

/**
 * This is the model class for table "admin_menu_access_user".
 *
 * @property integer $admin_menu_id
 * @property integer $user_id
 * @property integer $admin_menu_access_user_id
 *
 * @property AdminMenu $menu
 * @property User $user
 */
class AdminMenuAccessUser extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'admin_menu_access_user';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['admin_menu_id', 'user_id'], 'integer']
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'admin_menu_id' => Yii::t('app', 'Admin Menu ID'),
            'user_id' => Yii::t('app', 'User ID'),
            'admin_menu_access_user_id' => Yii::t('app', 'Admin Menu Access User ID'),
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getMenu()
    {
        return $this->hasOne(AdminMenu::className(), ['admin_menu_id' => 'admin_menu_id']);
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getUser()
    {
        return $this->hasOne(User::className(), ['id' => 'user_id']);
    }
}
