[TYPO3-mvc] query->Like

Christian Baer chr.baer at googlemail.com
Wed Jun 16 11:41:38 CEST 2010


Am 16.06.10 11:21, schrieb Christian Schwan - Dimme GmbH:
> Now I have to build with foreach array the Like query, but I think is not
> possible to do this.
>
> query->logicalOr(
>    array(
>
>
> foreach
>      $query->like('firstname', '%' . $searchQuery . '%'),
> end
>
>
>      )
> )

It should be possible, you can 'collect' your like-queries before:


$like_querys = array();
foreach($searchQuery AS $searchWord){
	$like_querys[] = $query->like('field', '%'.$searchWord.'%');
}
$query->logicalOr($like_querys);


Cheers,
Christian


More information about the TYPO3-project-typo3v4mvc mailing list