public function getRelatedCards() { $characterRelatedCardRepository = new CharacterRelatedCardRepository(); $characterRelatedCards = $characterRelatedCardRepository->getByCharakter($this['id']); $cardBaseTypes = array(); foreach ($characterRelatedCards as $characterRelatedCard) { $cardBaseTypes[] = $characterRelatedCard['card_base_type']; } $cardRepository = new CardRepository(); $cardRepository->setGroupBy('card_base_type'); return $cardRepository->getByCardBaseType($cardBaseTypes); }
/** * getter for related characters * * @return array<Character> */ public function getRelatedCharacters() { $characterRelatedCardRepository = new CharacterRelatedCardRepository(); $characterRelatedCards = $characterRelatedCardRepository->getByCardBaseType($this['card_base_type']); $characters = array(); foreach ($characterRelatedCards as $characterRelatedCard) { $characters[] = $characterRelatedCard['charakter']; } $characterRepository = new CharacterRepository(); return $characterRepository->getById($characters); }