<?php

/**
 * This is the model class for table "usertocallgroup".
 *
 * The followings are the available columns in table 'usertocallgroup':
 * @property string $userId
 * @property string $callGroupId
 */
class UserToCallGroup extends PhonalisaRecord
{

    public $userId;
    public $callGroupId;
    public $loggedIn;
    public $static_member = 1;

    public static function myAttributes()
    {
        return array(
            'userId' => 'userId',
            'callGroupId' => 'callGroupId',
            'loggedIn' => 'loggedIn',
            'static_member' => 'static_member'
        );
    }

    /**
     * Returns the static model of the specified AR class.
     * @param string $className active record class name.
     * @return CallGroup the static model class
     */
    public static function model($className = __CLASS__)
    {
        return parent::model($className);
    }

    /**
     * @return string the associated database table name
     */
    public function tableName()
    {
        return 'usertocallgroup';
    }

    /**
     * @return array validation rules for model attributes.
     */
    public function rules()
    {
        // NOTE: you should only define rules for those attributes that
        // will receive user inputs.
        return array(
            array('userId, callGroupId, loggedIn, static_member', 'safe'),
        );
    }


    /**
     * @return array customized attribute labels (name=>label)
     */
    public function attributeLabels()
    {
        return array(
            'userId' => __('USERTOCALLGROUP_MODEL_USER_ID'),
            'callGroupId' => __('USERTOCALLGROUP_MODEL_CALL_GROUP_ID'),
            'static_member' => __('TIERS_MODEL_STATIC_MEMBER')
        );
    }

    public function getUser()
    {
        return User::model()->findByPk($this->userId);
    }
}
