[TYPO3-mvc] MM_opposite_field

Felix Oertel mehl at foertel.com
Sun Jun 13 20:39:22 CEST 2010


Hi Christian,

Am 10.06.10 12:05, schrieb Christian Baer:
> Am 10.06.10 12:05, schrieb Jochen Rau:
>> Don't think in tables and fields, but think in objects and properties.
> but I try to contrain the query to a field from a MM-connected table.

he he ... we have to practice this some more ;-)

unfortunately there is too few code to know what you are trying to do, 
but i guess the following:

you got two models let's say "movie" and "actor". you want to find all 
movies which have the related object "actor" with the property 
"actor.name" euqaling "bruce". in this case unfortunately your approach 
would not work, because extbase won't join tables to look up properties 
of mm-related objects.

i would do the following:

$actors = $actorRepository->findByName('bruce');
$movies = $this->createQuery()
	->contains('actors', $actors)
	->execute();

this would give you all movies with connected actors named "bruce".

regards, foertel

PS: *cough* while writing this lines i recognized: your 
MM_opposite_field has to be "field_x" and not "table1".


More information about the TYPO3-project-typo3v4mvc mailing list