[TYPO3-mvc] Query M:M relations

Jochen Rau jochen.rau at typoplanet.de
Fri Apr 30 21:39:04 CEST 2010


Hi Stefan.

On 30.04.10 17:13, Stefan Isak wrote:
> thanks for reply. Could be a string e.g. holding the tag name.
>
> $query->equals("<   I don't know what to place here>  ", "foo");
>
> If an M:M relation exists tx_blogexample_domain_model_post.tags holds the
> amount of relations.
> So 'tags.name' is propably wrong. But 'tag.name' isn't working.

$query->equals('tags.name', $tag)

should work with Extbase trunk or at least 1.1.0beta1. See BlogExample 
trunk for a working example.

Regards
Jochen

P.S. Please don't TOFU ;-)
http://en.wikipedia.org/wiki/Posting_style#Top-posting

>
> 2010/4/30 Jochen Rau<jochen.rau at typoplanet.de>
>
>> Hi Stefan.
>>
>>
>> On 30.04.10 16:49, Stefan Isak wrote:
>>
>>> right now I can't get behind the correct syntax to perform a mm query.
>>>
>>> blog_example:
>>> Lets say I have a given array of tag names or tag uids. Tags have an mm
>>> relation to posts.
>>> How can I create a query to get all posts having the given tags.
>>>
>>> As Jochen said, extbase resolves mm relations automatically.
>>> So I always tried something like
>>>
>>> public function filterAll($filters) {
>>>                $query = $this->createQuery();
>>>                foreach($filters as $filter) $constraints[] =
>>> $query->equals("
>>> tags.name", $filter);
>>>                ....
>>> }
>>>
>>
>> Uhm. What is $filter? A string? An object? Could you please post some more
>> code ;-)
>>
>> Jochen
>>
>> _______________________________________________
>> TYPO3-project-typo3v4mvc mailing list
>> TYPO3-project-typo3v4mvc at lists.typo3.org
>> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
>>



More information about the TYPO3-project-typo3v4mvc mailing list