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

class ArticleIndex extends ActiveRecord
{
6
    public $custom_column;
7

8 9 10 11
    public static function indexName()
    {
        return 'yii2_test_article_index';
    }
12

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

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

23 24 25 26
    public function getSnippetSource()
    {
        return $this->source->content;
    }
Alexander Makarov committed
27

28 29 30 31 32 33
    public static function createQuery($config = [])
    {
        $config['modelClass'] = get_called_class();

        return new ArticleIndexQuery($config);
    }
AlexGx committed
34
}