guild/common/models/CardSkill.php

68 lines
1.4 KiB
PHP
Raw Normal View History

2018-10-12 14:52:08 +03:00
<?php
namespace common\models;
use Yii;
/**
* This is the model class for table "card_skill".
*
* @property int $id
* @property int $card_id
* @property int $skill_id
*
* @property Skill $skill
* @property UserCard $card
*/
class CardSkill extends \yii\db\ActiveRecord
{
/**
* {@inheritdoc}
*/
public static function tableName()
{
return 'card_skill';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['card_id', 'skill_id'], 'required'],
[['card_id', 'skill_id'], 'integer'],
[['skill_id'], 'exist', 'skipOnError' => true, 'targetClass' => Skill::className(), 'targetAttribute' => ['skill_id' => 'id']],
[['card_id'], 'exist', 'skipOnError' => true, 'targetClass' => UserCard::className(), 'targetAttribute' => ['card_id' => 'id']],
];
}
/**
* {@inheritdoc}
*/
public function attributeLabels()
{
return [
'id' => 'ID',
'card_id' => 'Card ID',
'skill_id' => 'Skill ID',
];
}
/**
* @return \yii\db\ActiveQuery
*/
public function getSkill()
{
return $this->hasOne(Skill::className(), ['id' => 'skill_id']);
}
/**
* @return \yii\db\ActiveQuery
*/
public function getCard()
{
return $this->hasOne(UserCard::className(), ['id' => 'card_id']);
}
}