Commit 0d2ab69d authored by Shakarim Sapa's avatar Shakarim Sapa

- Добавлена модель для таблицы расписания рассылок

parent 5136b56a
<?php
namespace common\modules\blog\models;
use Yii;
use common\modules\blog\models\Post;
/**
* This is the model class for table "blog_schedule".
*
* @property integer $id
* @property string $email
* @property integer $post_id
* @property string $date
*
* @property Post $post
*/
class BlogSchedule extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'blog_schedule';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['email', 'post_id', 'date'], 'required'],
[['post_id'], 'integer'],
[['date'], 'safe'],
[['email'], 'string', 'max' => 255],
[['post_id'], 'exist', 'skipOnError' => true, 'targetClass' => Post::className(), 'targetAttribute' => ['post_id' => 'id']],
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => 'ID',
'email' => 'Email',
'post_id' => 'Post ID',
'date' => 'Date',
];
}
/**
* @return \yii\db\ActiveQuery
*/
public function getPost()
{
return $this->hasOne(Post::className(), ['id' => 'post_id']);
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment