[Flow] Query on OneToMany relation

Christian Müller christian.mueller at typo3.org
Sat Apr 26 20:22:09 CEST 2014


Sorry Philipp but notice that attendees is a collection and he wants to 
compare to a property of the collection members... That IMHO won't work. ;)

Cheers,
Christian

Zedd wrote:
> Uhm,
>
> this should work out of the box (sorry Christian :D). The issue here seems to be the orderings.
>
> This is wrong (actually, it's sorting by 'start', then by 'ASC'):
> ->setOrderings(array(
>     ’start', \TYPO3\Flow\Persistence\QueryInterface::ORDER_ASCENDING
> ))
>
> Try this instead (notice that the property is the key, the direction the value):
> ->setOrderings(array(
>     ’start' =>  \TYPO3\Flow\Persistence\QueryInterface::ORDER_ASCENDING
> ))
>
> Additionally, you might want to consider using the models identifier instead of passing the object directly to QueryObject::equals. While it doesn't break for "equals", it might when using "in" or "contains".
>
> Greetings,
> Philipp Maier
>
> On Apr 26, 2014, at 7:53 PM, Christian Müller<christian.mueller at typo3.org>  wrote:
>
>> Hi Alexander,
>>
>>> $query = $this->createQuery();
>>>          $result = $query->matching(
>>>                      $query->logicalAnd(
>>>                          $query->equals('attendees.member', $member),
>>> Is it even possible without using SQL syntax?
>>
>> No, for this type of question you need to use a DQL query because you need to join the attendees and then query for member...
>> Cheers,
>> Christian
>> _______________________________________________
>> Flow mailing list
>> Flow at lists.typo3.org
>> http://lists.typo3.org/cgi-bin/mailman/listinfo/flow
>


More information about the Flow mailing list