[TYPO3-mvc] repository chain multiple "likes"
Frans van der Veen[netcreators]
frans at netcreators.com
Tue Dec 8 14:01:04 CET 2009
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
--
Frans van der Veen
Certified TYPO3 Integrator / TYPO3 Developer
+31(0)26 - 442 1950
_________________________________________________
Netcreators: Open Source, Open Minds, Open People
_________________________________________________
More information about the TYPO3-project-typo3v4mvc
mailing list