и сделать разные ссылки в выдаче поиска.
Вот начала делать пока на две таблицы
public function actionSearch($q)
{
$from = '(
SELECT id, title, CONCAT(short, full) AS text, CONCAT("/video/", slug,"/",id) AS link FROM video UNION
SELECT id, title, descr AS text, CONCAT("/clip/",id) AS link FROM clip UNION
)';
$where = 'WHERE t.text LIKE :query OR t.title LIKE :query';
$params = array(
':query' => '%' . $q . '%',
);
$countSql = 'SELECT COUNT(*) FROM ' . $from . ' AS t ' . $where;
$dataSql = 'SELECT t.* FROM ' . $from . ' AS t ' . $where;
$count = Yii::$app->db->createCommand($countSql)->queryScalar($params);
$dataProvider = new SqlDataProvider([
'sql' => $dataSql,
'params' => $params,
'totalCount' => $countSql,
'pagination' => [
'pageSize' => 20,
],
]);
выдает ошибку
SQLSTATE[HY093]: Invalid parameter number: no parameters were bound
The SQL being executed was: SELECT COUNT(*) FROM (
SELECT id, title, CONCAT(short, full) AS text, CONCAT("/video/", slug,"/",id) AS link FROM video UNION
SELECT id, title, descr AS text, CONCAT("/clip/",id) AS link FROM clip UNION
) AS t WHERE t.text LIKE :query OR t.title LIKE :query
Error Info: Array
(
[0] => HY093
[1] => 0
)