[TYPO3-mvc] documentation, and example exbase m:n relation query
Anja Leichsenring
aleichsenring at ab-softlab.de
Sun Jun 29 13:34:59 CEST 2014
Hi Muriel,
you don't need to care about the character of any multi dimensional
relations using extbase.
If your model contains such a relation, it is represented by
ObjectStorages. Then you ask the repository about the model and use the
getter to retrieve the child object, which contains many instances of
the child model.
It is essential that your TCA correctly sets up the multi dimensional
relationship!
like this (pseudo code):
class A extends AbstractEntity {
/**
* @var ObjectStorage<Model B>
*/
$children;
public function getChildren() {
return $this->children();
}
in your controller you call
$a = $Arepository -> findByUid(42);
then you can do
foreach ($a->getChildren() as $child) {
$child->getName();
}
Nothing else you need, and there is no difference in handling of 1:n and
n:m relations.
Hope that helps?
Regards Anja
On 29.06.2014 12:48, Muriel le Pair wrote:
> Hi,
>
> I feel I'm missing some essential documentation about the Extbase way of
> doing stuff.
>
> How for instance do I query a m:n relation? Where can I find a good
> example?
>
> --
> kind regards,
>
> Muriel le Pair
More information about the TYPO3-project-typo3v4mvc
mailing list