if(!empty($this->author)){
$sql = new Expression("(SELECT name FROM book_authors WHERE id = product_book.book_id)");
$row = (new Query())
->from('product_book')
->where('product_book.product_id=products.id')
->andWhere(['product_book.book_name' => 'book_authors'])
->andFilterWhere(['in', $sql, $this->author]);
$query->andFilterWhere(['exists', $row]);
}
function my_substr_count(string $text, string $char):int
{
if(strlen($char) > 1){
return -1;
}
$re = "/($char)/";
preg_match_all($re, $text, $matches, PREG_SET_ORDER, 0);
return count($matches);
}