sphinx\ActiveQuery snippetByModel()

snippetByModel() public method Sets the snippetCallback() to fetchSnippetSourceFromModels(), which allows to fetch the snippet source strings from the Active Record models, using method yii\sphinx\ActiveRecord::getSnippetSource(). For example: class Article extends ActiveRecord { public function getSnippetSource() { return file_get_contents('/path/to/source/files/' . $this->id . '.txt');; } } $articles = Article::find()->snippetByModel()->all(); Warning: this

sphinx\ActiveQuery populate()

populate() public method Converts the raw query results into the format as specified by this query. This method is internally used to convert the data fetched from database into the format as required by this query. public array populate ( $rows )$rows array The raw query result from database return array The converted query result

sphinx\ActiveQuery one()

one() public method Executes query and returns a single row of result. public yii\sphinx\ActiveRecord|array|null one ( $db = null )$db yii\sphinx\Connection The DB connection used to create the DB command. If null, the DB connection returned by $modelClass will be used. return yii\sphinx\ActiveRecord|array|null A single row of query result. Depending on the setting of asArray(), the query result may be either an array or an ActiveRecord object. Null will be returned if the query resu

sphinx\ActiveQuery EVENT_INIT

EVENT_INIT event of type \yii\sphinx\Event An event that is triggered when the query is initialized via init().

sphinx\ActiveQuery defaultConnection()

defaultConnection() protected method protected yii\sphinx\Connection defaultConnection ( )return yii\sphinx\Connection Default connection value.

sphinx\ActiveQuery fetchSnippetSourceFromModels()

fetchSnippetSourceFromModels() protected method Fetches the source for the snippets using yii\sphinx\ActiveRecord::getSnippetSource() method. protected array fetchSnippetSourceFromModels ( $models )$models yii\sphinx\ActiveRecord[] Raw query result rows. return array Snippet source strings throws yii\base\InvalidCallException if asArray() enabled.

sphinx\ActiveQuery init()

init() public method Initializes the object. This method is called at the end of the constructor. The default implementation will trigger an EVENT_INIT event. If you override this method, make sure you call the parent implementation at the end to ensure triggering of the event. public void init ( )

sphinx\ActiveQuery createCommand()

createCommand() public method Creates a DB command that can be used to execute this query. public yii\sphinx\Command createCommand ( $db = null )$db yii\sphinx\Connection The DB connection used to create the DB command. If null, the DB connection returned by $modelClass will be used. return yii\sphinx\Command The created DB command instance.

sphinx\ActiveQuery callSnippets()

callSnippets() protected method Builds a snippets from provided source data. protected array callSnippets ( array $source )$source array The source data to extract a snippet from. return array Snippets list. throws yii\base\InvalidCallException in case match() is not specified.

sphinx\ActiveQuery all()

all() public method Executes query and returns all results as an array. public array all ( $db = null )$db yii\sphinx\Connection The DB connection used to create the DB command. If null, the DB connection returned by $modelClass will be used. return array The query results. If the query results in nothing, an empty array will be returned.