ArticleIndex.php 589 Bytes
Newer Older
1 2 3 4
<?php

namespace yiiunit\data\sphinx\ar;

5 6
use yii\db\ActiveRelation;

7 8 9 10 11 12 13 14 15 16 17 18 19
class ArticleIndex extends ActiveRecord
{
	public $custom_column;

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

	public static function favoriteAuthor($query)
	{
		$query->andWhere('author_id=1');
	}
20 21 22

	public function getSource()
	{
23
		return $this->hasOne('db', ArticleDb::className(), ['id' => 'id']);
24
	}
25

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

31 32 33 34
	public function getSnippetSource()
	{
		return $this->source->content;
	}
35
}