[TYPO3-mvc] WHERE IN (...) query statement

Rikkert Steenbergen - Buyways B.V. rikkert at buyways.nl
Fri Oct 23 14:05:41 CEST 2009


Hi,

I use the following workarround for now (perhaps not very elegant):

$constraint = null;
foreach($list as $uid) {
    if (!isset($constraint)) {
        $constraint = $query->equals('field', $uid);
    } else {
        $constraint = $query->logicalOr(
            $constraint,
            $query->equals('field', $uid)
        );
    }           
}
$items = $query->matching($constraint)->execute();

Regards, Rikkert

Fernando Arconada wrote:
> I'm in the same situation but with videos and categories. I want to 
> retrieve all videos that belong to a category, please help
>
>
> Thanks
>
>
> El Tue, 20 Oct 2009 15:39:45 +0200, Peter Beernink escribió:
>
>   
>> Hi,
>>
>> For a controller I'm currently working on, I'm looking for a way to
>> perform a WHERE IN (...) statement.
>> To explain my situation:
>> In the fe_users table, I have a field by which I map the fe_user to a
>> object called Member.
>>
>> Now I want to be able to fetch all Member objects which are a member of
>> a specific set of fe_groups (and have some other options). To limit the
>> set as soon as possible, I start by limiting the group based on
>> fe_user->fe_group relation.
>> Based on this set, I want to use the
>> $repository->createQuery()->matching() to perform the rest of the
>> selection, however, I could not find any way of extending the query
>> within in a loop.
>>
>> Do you have any suggestions on how to achieve this, or perhaps know a
>> better way to add an IN (..,..,..) statement to the query?
>>
>> Thanks in advance,
>>
>> Peter
>>     
>
>
>
>
> _______________________________________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc

-- 

    * Rikkert Steenbergen, Projectleider
    * Buyways B.V.  Friesestraatweg 215c, 9743 AD Groningen
    * T. 050 853 66 33  M. 06 27 44 21 99  F. 050 853 66 01  KvK.
      01074105  www.buyways.nl <http://www.buyways.nl>

    *
      ------------------------------------------------------------------------
    * Disclaimer: deze e-mail is vertrouwelijk en uitsluitend bedoeld
      voor de geadresseerde. Als blijkt dat het bericht niet voor u
      bestemd is, verzoeken wij u de afzender hiervan op de hoogte te
      stellen. Het verstrekken van de informatie aan en gebruik door
      anderen is niet toegestaan. Buyways B.V. sluit iedere
      aansprakelijkheid uit die voortvloeit uit elektronische verzending.
    *
      ------------------------------------------------------------------------



More information about the TYPO3-project-typo3v4mvc mailing list