/** * @param IRegionalSupport $regional_support * @return void */ public function addRegionalSupport(IRegionalSupport $regional_support) { $new_order = 0; $regional_supports = $this->getRegionalSupports(); if (count($regional_supports) > 0) { $last_one = end($regional_supports); $new_order = $last_one->getOrder() + 1; } $regional_support->setOrder($new_order); AssociationFactory::getInstance()->getOne2ManyAssociation($this, 'RegionalSupports')->add($regional_support); }
/** * @param IRegionalSupport $regional_support * @return array */ public static function convertRegionalSupportToArray(IRegionalSupport $regional_support) { $res = array(); $res['id'] = $regional_support->getIdentifier(); $res['region_id'] = $regional_support->getRegion()->getIdentifier(); $res['region_name'] = $regional_support->getRegion()->getName(); $res['support_channels'] = array(); foreach ($regional_support->getSupportChannelTypes() as $support_channel) { array_push($res['support_channels'], self::convertSupportChannel($regional_support->getRegion()->getIdentifier(), $support_channel)); } return $res; }