[TYPO3-mvc] repository chain multiple "likes"

Alex Bailey admin at v1le.de
Tue Dec 8 14:21:00 CET 2009


Frans van der Veen[netcreators] schrieb:
> Hi Alex,
> 
> You can try iterating the fields like this (warning: untested):
> 
> $query = $this->createQuery();
> $columnMatch = false;
> foreach($columns as $column) {
> 	if($columnMatch == false) {
> 		$columnMatch = $query->like($column, '%' . $this->search . '%');
> 	} else {
> 		$columnMatch = $query->logicalAnd(
> 			$columnMatch,
> 			$query->like($column, '%' . $this->search . '%')
> 		);
> 	}
> }
> $result = $query->matching($columnMatch)->execute();
> 
> Good luck.
> 
> ~Frans
> 
> Alex Bailey wrote:
>> Jochen Rau schrieb:
>>> Hi Steffen.
>>>
>>> schrieb Steffen Ritter:
>>>> $query->logicalAND($query->like(),$query->like())
>>> Early bird catches the worm ... ;-)
>>>
>>> Jochen
>>>
>> Hey guys :)
>>
>> Thanks for your answers I think I have an idea now. But i still have one
>> problem. My "likes" are being created dynamic that means sometimes i
>> maybe have 1 sometimes 3 likes. So I can't set them static inside the
>> function. Is there any way to insert them inside a foreach loop?
>>
>> example:
>>
>> 1. loop ->
>> $query->logicalAND($query->like())
>>
>> 2. loop ->
>> $query->logicalAND($query->like(),$query->like())
>>
>> and so on...
>>
>> regards
>>
>> Alex
> 
> 

I'll try it thanks :) would be really nice if there would be some sort 
of better way around this problem.

regards

Alex


More information about the TYPO3-project-typo3v4mvc mailing list