ArticleIndex.php 747 Bytes
Newer Older
1
<?php
2
namespace yiiunit\data\ar\sphinx;
3 4 5

class ArticleIndex extends ActiveRecord
{
6
    public $custom_column;
7

Alexander Makarov committed
8 9 10
    /**
     * @inheritdoc
     */
11 12 13 14
    public static function indexName()
    {
        return 'yii2_test_article_index';
    }
15

16 17 18 19
    public function getSource()
    {
        return $this->hasOne(ArticleDb::className(), ['id' => 'id']);
    }
20

21 22 23 24
    public function getTags()
    {
        return $this->hasMany(TagDb::className(), ['id' => 'tag']);
    }
25

Alexander Makarov committed
26 27 28
    /**
     * @inheritdoc
     */
29 30 31 32
    public function getSnippetSource()
    {
        return $this->source->content;
    }
Alexander Makarov committed
33

Alexander Makarov committed
34 35 36 37
    /**
     * @return ArticleIndexQuery
     */
    public static function find()
38
    {
39
        return new ArticleIndexQuery(get_called_class());
40
    }
AlexGx committed
41
}