*/ public function getThirdPartiesAssociated(AccompanyingPeriodWork $accompanyingPeriodWork): array { $thirdParties = $this->thirdPartiesAssociated->getThirdPartiesAssociated($accompanyingPeriodWork->getAccompanyingPeriod()); if (null !== $tp = $accompanyingPeriodWork->getHandlingThierParty()) { $thirdParties[] = $tp; } foreach ($accompanyingPeriodWork->getThirdParties() as $thirdParty) { $thirdParties[] = $thirdParty; } return array_values( // filter objects to remove duplicates array_filter( $thirdParties, fn ($o, $k) => array_search($o, $thirdParties, true) === $k, ARRAY_FILTER_USE_BOTH ) ); } }