[TYPO3-mvc] repository chain multiple "likes"

Alex Bailey admin at v1le.de
Tue Dec 8 11:33:15 CET 2009


Hey,

another little question from me :)

At the moment im working on a search function to search for various 
fields in my database to do so I use the like function in the repository

$query->matching($query->like($field, '%'.$this->search.'%'));

This is working fine for me aslong as I use a single field to compare.

Now I want to search multiple fields, so my idea was to chain the likes 
together in a foreach loop.

foreach($this->searchFieldArray AS $field)
$query->matching($query->like($field, '%'.$this->search.'%'));
					
Now obvious this doesnt work since, it seems you cant just link them 
together like that.

Does anybody have a clue what I can do in this situation to solve this?

Thanks in advance

regards

Alex


More information about the TYPO3-project-typo3v4mvc mailing list