<?php

namespace backend\models;

use Yii;

/**
 * This is the model class for table "book_mark".
 *
 * @property integer $id
 * @property integer $bookId
 * @property integer $chapterIndex
 * @property integer $chapterId
 * @property integer $quotePosition
 *
 * @property Book $book
 * @property Chapter $chapter
 */
class BookMark extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'book_mark';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['bookId', 'chapterIndex', 'chapterId', 'quotePosition'], 'integer']
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'bookId' => 'Book ID',
            'chapterIndex' => 'Chapter Index',
            'chapterId' => 'Chapter ID',
            'quotePosition' => 'Quote Position',
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getBook()
    {
        return $this->hasOne(Book::className(), ['id' => 'bookId']);
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getChapter()
    {
        return $this->hasOne(Chapter::className(), ['id' => 'chapterId']);
    }
}
