/** * Retrive the list of enum by type * * @param string $type */ public function getEnum($type, $filters = array()) { /** * @var \Application\Model\Mapper\EnumeratedMapper */ $enumMapper = \Application\Model\Mapper\EnumeratedMapper::getInstance(); if (!$type) { throw new Exceptions\InvalidArgumentException("Enum type is mandatory"); } if ($filters && !is_array($filters)) { throw new Exceptions\InvalidArgumentException("filters is not an array"); } switch ($type) { case self::COUNTRY_ENUM_NAME: return $enumMapper->listCountry(); case self::CURRENCY_ENUM_NAME: return $enumMapper->listCurrency(); case self::LANGUAGE_ENUM_NAME: return $enumMapper->listLanguage(); case self::SECTOR_ENUM_NAME: return $enumMapper->listSector(); case self::STATUS_ENUM_NAME: return $enumMapper->listStatus(); case self::COMPANY_TYPE_ENUM_NAME: return $enumMapper->listCompanyType(); case self::TIME_ZONE_STATIC_ENUM_NAME: return $enumMapper->listStaticTimeZone(); case self::MNO_ENUM_NAME: return $enumMapper->listMNO(); default: // Get service provider id if (isset($filters['serviceProvider'])) { $orgId = $filters['serviceProvider']; } else { $org = \App::getOrgUserLogged(); $orgId = OrgService::getInstance()->getServiceProviderLevelId($org); } // Get enum by service provider switch ($type) { case self::RAID_ENUM_NAME: return $enumMapper->listRaid($orgId); case self::SERVICE_PROVIDER_ZONE_ENUM_NAME: $zones = $enumMapper->listServiceProviderZone($orgId); return $this->_filterDefaultValues($zones); case self::SERVICE_PROVIDER_DESTINATION_ENUM_NAME: $destinations = $enumMapper->listServiceProviderDestination($orgId); return $this->_filterDefaultValues($destinations); case self::TIME_ZONE_ENUM_NAME: return $enumMapper->listTimeZone($orgId); case self::SERVICE_PROVIDER_REGION_ENUM_NAME: $regions = $enumMapper->listServiceProviderRegion($orgId); return $this->_filterDefaultValues($regions); default: throw new AppEx\InvalidArgumentException("Enumerated " . $type . " doesn't exist"); } } }
public function setUp() { $this->_enumeratedMapper = EnumeratedMapper::getInstance(); }
public function setUp() { $this->_enumeratedMapper = EnumeratedMapper::getInstance(); $this->_user = $this->_createAuthUser(array('userName' => 'SimUserTest', 'organizationId' => self::PROVIDER_COMMERCIAL_ORG_ID)); }