Issue on where paremeter

Hey everyone , i am using yii2 in my project.

Can someone tell me what is wrong with my code ? i followed the docs.





			$words = explode(' ', $search);

			$where = false;

			if (is_array($words) && !empty($words)) 

			{

				foreach ($words as $key => $w)

				{

					if ($w == '') continue;

					$filters.= $where ? ' AND ( ' : ' WHERE ( ';

					$filters.= " LOWER(unaccent(account.name)) LIKE LOWER(unaccent('% :a" . $key . "%'))";

					$filters.= " OR LOWER(unaccent(account.email)) LIKE LOWER(unaccent('% :a" . $key . "%'))";

					$filters.= " OR LOWER(unaccent(account.phone)) LIKE LOWER(unaccent('% :a" . $key . "%'))";

					$filters.= " OR LOWER(unaccent(account.street_address)) LIKE LOWER(unaccent('% :a" . $key . "%'))";

					$filters.= " OR LOWER(unaccent(account.street_address2)) LIKE LOWER(unaccent('% :a" . $key . "%'))";

					$filters.= " OR LOWER(unaccent(account.postal_code)) LIKE LOWER(unaccent('% :a" . $key . "%'))";

					$filters.= " OR LOWER(unaccent(account.place)) LIKE LOWER(unaccent('% :a" . $key . "%'))";

					$filters.= " OR LOWER(unaccent(account.city)) LIKE LOWER(unaccent('% :a" . $key . "%'))";

					$filters.= " OR LOWER(unaccent(account.region)) LIKE LOWER(unaccent('% :a" . $key . "%'))";

					$filters.= ' ) ';

					$fields[':' . $key] = $w;

					if (!$where) $where = true;

				}

			}

			

			$accounts = Account::find()

				->joinWith('installations')

				->joinWith('installations.services')

				->where( $filters )

				->addParams( $fields )

				->groupBy('account.id')

				->orderBy('count(service) DESC')

				->limit(20)->all();




This return the following error:





Invalid parameter number: 0