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 cards via common card_group_type of their cardBaseType * * @return array<Card> */ public function getRelatedCards() { $cardBaseType = $this->getAdditionalField('cardBaseType'); if ($cardBaseType) { $cardBaseTypeRepository = new CardBaseTypeRepository(); $cardBaseTypeRepository->addAdditionalWhere(array('column' => 'id', 'value' => $this['card_base_type'], 'xxx' => '!=')); $cardBaseTypeList = $cardBaseTypeRepository->getByCardGroupType($cardBaseType['card_group_type']); $cardBaseTypes = array(); foreach ($cardBaseTypeList as $oneCardBaseType) { $cardBaseTypes[] = $oneCardBaseType['id']; } $cardRepository = new CardRepository(); $cardRepository->setGroupBy('card_base_type'); return $cardRepository->getByCardBaseType($cardBaseTypes); } }