ArticleIndex.php 903 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 25
    public function getSourceCompositeLink()
    {
        return $this->hasOne(ArticleDb::className(), ['id' => 'id', 'author_id' => 'author_id']);
    }

26 27 28 29
    public function getTags()
    {
        return $this->hasMany(TagDb::className(), ['id' => 'tag']);
    }
30

Alexander Makarov committed
31 32 33
    /**
     * @inheritdoc
     */
34 35 36 37
    public function getSnippetSource()
    {
        return $this->source->content;
    }
Alexander Makarov committed
38

Alexander Makarov committed
39 40 41 42
    /**
     * @return ArticleIndexQuery
     */
    public static function find()
43
    {
44
        return new ArticleIndexQuery(get_called_class());
45
    }
AlexGx committed
46
}