60 lines
1019 B
PHP
60 lines
1019 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace common\models;
|
||
|
|
|
||
|
|
use Yii;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* This is the model class for table "post_tag".
|
||
|
|
*
|
||
|
|
* @property int $id
|
||
|
|
* @property string $name
|
||
|
|
* @property int $frequency
|
||
|
|
*
|
||
|
|
* @property PostHasPostTag[] $postHasPostTags
|
||
|
|
*/
|
||
|
|
class PostTag extends \yii\db\ActiveRecord
|
||
|
|
{
|
||
|
|
/**
|
||
|
|
* {@inheritdoc}
|
||
|
|
*/
|
||
|
|
public static function tableName()
|
||
|
|
{
|
||
|
|
return 'post_tag';
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* {@inheritdoc}
|
||
|
|
*/
|
||
|
|
public function rules()
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
[['name'], 'required'],
|
||
|
|
[['frequency'], 'integer'],
|
||
|
|
[['name'], 'string', 'max' => 100],
|
||
|
|
];
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* {@inheritdoc}
|
||
|
|
*/
|
||
|
|
public function attributeLabels()
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
'id' => 'ID',
|
||
|
|
'name' => 'Name',
|
||
|
|
'frequency' => 'Frequency',
|
||
|
|
];
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @return \yii\db\ActiveQuery
|
||
|
|
*/
|
||
|
|
public function getPostHasPostTags()
|
||
|
|
{
|
||
|
|
return $this->hasMany(PostHasPostTag::className(), ['tag_id' => 'id']);
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
}
|