How to get property of associated table?

hey there,
very basic question but I’m kind of stuck with the syntax here:
I have an entity query. The entity is associated to another table which has a ‘name’ property? (many to many association)

My $query looks like this when I debug it:
/plugins/MailCalculator/src/Controller/PostalServicesController.php (line 140)
object(MailCalculator\Model\Entity\PostalService) {

    'id' => (int) 1,
    'carrier' => 'Deutsche Post'
...

    },
    'modified' => null,
    '_matchingData' => [
        'Insurances' => object(MailCalculator\Model\Entity\Insurance) {

            'id' => (int) 2,
            'name' => 'Wert',
            'price' => (float) 4.3,
...

basically the question is, how do I get the values out from the __matchingData array?

I thought the syntax for it should be something like:
$var = $query->insurance->name or $var = $query->insurances[‘name’] but both things debugged give me ‘null’

thanks in advance, Rich

after running the query you can access it as $result[’_matchingData’][‘Insurances’]->name

1 Like

oh man, tried this one as well but missed the ' ' for the _matchingData…

thanks a lot!