68 lines
1.4 KiB
PHP
68 lines
1.4 KiB
PHP
|
<?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']);
|
||
|
}
|
||
|
}
|