ArticleIndex.php 603 Bytes
Newer Older
1
<?php
2
namespace yiiunit\data\ar\sphinx;
3 4 5 6 7 8 9 10 11 12

class ArticleIndex extends ActiveRecord
{
	public $custom_column;

	public static function indexName()
	{
		return 'yii2_test_article_index';
	}

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

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

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

28
	public static function createQuery($config = [])
Alexander Makarov committed
29
	{
30 31
		$config['modelClass'] = get_called_class();
		return new ArticleIndexQuery($config);
Alexander Makarov committed
32
	}
33
}