How to get all cases linke to Opportunity?

I try to get all cases, linke to an opportunity (for example).

I need the information in a LogicHook because i want to link the same cases to another type (in this specific case to a document).

I´ve tried a lot, but always unable to fetch the linked Cases.

                $cases1 = $opportunity->get_linked_beans('opportunities_cases_1', 'aCase');

                $cases2 = $opportunity->get_linked_beans('opportunities_cases', 'aCase');

                if ($opportunity->load_relationship('cases')){
                   $caseBeans = $opportunity->cases->getBeans();
                }

In this example - $case1 and $case2 is "0" and $caseBeans never reached.

What´s the best or correct way to determine all attached/linke cases to a bean?

Appreciate any help. Thanks a lot.

Parents Reply Children