/** * Prefix organization type to OrgId * @param string $id * @param boolean $parent Default false. Use it to prefix parent organization type. * @return string */ public static function buildOrgIdByOrganizationProto(Organization $proto) { $map = array(OrgPB\OrgType::MASTER => "Application\\Model\\Mapper\\Organization\\OrgMasterMapper", OrgPB\OrgType::SERVICE_PROVIDER => "Application\\Model\\Mapper\\Organization\\OrgServiceProviderMapper", OrgPB\OrgType::CUSTOMER => "Application\\Model\\Mapper\\Organization\\OrgCustomerMapper"); $id = $proto->getId(); if (isset($map[$proto->getType()])) { $mapperClass = $map[$proto->getType()]; $id = $mapperClass::buildOrgId($id); } return $id; }