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

Alexander Makarov committed
4
use yii\sphinx\ActiveQuery;
5

6 7 8 9 10 11 12 13 14
class ArticleIndex extends ActiveRecord
{
	public $custom_column;

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

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

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

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

	public static function createQuery()
	{
		return new ArticleIndexQuery(['modelClass' => get_called_class()]);
	}
34
}