public function testLoadByName() { $this->_org->save(); $org = $this->_service->loadByName($this->_org->getName()); $this->assertNotNull($org); $this->assertInstanceOf('\\Application\\Model\\Organization\\OrgMasterModel', $org); $this->assertEquals($this->_org->getId(), $org->getId()); }
public function testLoadOrg() { // Persist the org model $this->_org->save(); $org = $this->_service->load($this->_org->getId()); $this->assertNotNull($org); $this->assertInstanceOf('\\Application\\Model\\Organization\\OrgServiceProviderModel', $org); $this->assertEquals($this->_org->getId(), $org->getId()); }
public function testActivate() { // Persist the org model $this->_org->save(); $this->_service->deactivate($this->_org->getId()); $org = $this->_service->load($this->_org->getId()); $this->assertEquals($org->status, OrgAggregatorModel::ORG_STATUS_DEACTIVATED); $this->_service->activate($this->_org->getId()); $org = $this->_service->load($this->_org->getId()); $this->assertEquals($org->status, OrgAggregatorModel::ORG_STATUS_ACTIVATED); }
public function getServiceProviderLevelId(\Application\Model\OrgModelAbstract $org) { switch (true) { case $org instanceof \Application\Model\Organization\OrgServiceProviderModel: return $org->getId(); case $org instanceof \Application\Model\Organization\OrgCustomerModel: return $org->getParentId(); default: // Search customer parent for aggregator or enduser $org = $this->getParentByType($org, OrgCustomerModel::ORG_TYPE); return $org ? $org->getParentId() : null; } }
/** * * @param OrganizationModel $organization * @return UserModel */ public function setOrganization(OrgModelAbstract $organization) { if ($organization instanceof OrgModelAbstract) { $this->setOrganizationId($organization->getId()); } return $this; }
/** * * @param OrgModelAbstract $parent * @return OrgModelAbstract */ public function setParent(OrgModelAbstract $parent) { $this->setParentId($parent->getId()); $this->_parent = null; return $this; }
/** * @param Application\Model\ServicePackModel $service * @return boolean */ public function removeCustomer(ServicePackModel $service, OrgModelAbstract $org) { if (!strlen((string) $service->getId())) { throw new AppEx\InvalidArgumentException("Service pack does not have an Id"); } if (!$org instanceof OrgCustomerModel) { throw new AppEx\InvalidArgumentException("Organization must be a customer."); } $orgId = $org->getId(); if (!isset($orgId) && !strlen($orgId)) { throw new AppEx\InvalidArgumentException("Organization customer does not have an Id"); } if ($service->commercialGroup) { $errors[] = "\t- " . \Zend_Json::encode('Service Pack already has commercial groups assigned '); $errors = implode("\n", $errors); throw new AppEx\ValidateException("The supplServices model does not pass the validation rules:\n" . $errors); } $result = $this->getMapper()->removeCustomer($service->getId(), $org->getId()); \App::audit('Removed customer ' . $org->getId() . ' from service pack with Id ' . $service->getId(), $service); return $result; }