Commit 5a8afcf7 by Klimov Paul

"yii\sphinx\ActiveQuery" updated to throw exception on conflict between…

"yii\sphinx\ActiveQuery" updated to throw exception on conflict between "asArray" and "snippetByModel" options.
parent 2c22fe3f
No related merge requests found
......@@ -7,6 +7,7 @@
namespace yii\sphinx;
use yii\base\InvalidCallException;
use yii\db\ActiveQueryInterface;
use yii\db\ActiveQueryTrait;
......@@ -186,10 +187,14 @@ class ActiveQuery extends Query implements ActiveQueryInterface
/**
* Fetches the source for the snippets using [[ActiveRecord::getSnippetSource()]] method.
* @param ActiveRecord[] $models raw query result rows.
* @throws \yii\base\InvalidCallException if [[asArray]] enabled.
* @return array snippet source strings
*/
protected function fetchSnippetSourceFromModels($models)
{
if ($this->asArray) {
throw new InvalidCallException('"' . __METHOD__ . '" unable to determine snippet source from plain array. Either disable "asArray" option or use regular "snippetCallback"');
}
$result = [];
foreach ($models as $model) {
$result[] = $model->getSnippetSource();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment