[TYPO3-mvc] repository chain multiple "likes"

Steffen Ritter info at rs-websystems.de
Tue Dec 8 11:57:54 CET 2009


Alex Bailey schrieb:
> 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
$query->logicalAND($query->like(),$query->like())


More information about the TYPO3-project-typo3v4mvc mailing list