本文整理汇总了PHP中PhoneNumber::persist方法的典型用法代码示例。如果您正苦于以下问题:PHP PhoneNumber::persist方法的具体用法?PHP PhoneNumber::persist怎么用?PHP PhoneNumber::persist使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhoneNumber
的用法示例。
在下文中一共展示了PhoneNumber::persist方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generateTestSsDemoDataAction
public function generateTestSsDemoDataAction()
{
$basePath = Zend_Registry::get('basePath');
$xmlFile = $basePath . 'xml/ss-demo-data.xml';
$xml = new SimpleXMLElement(file_get_contents($xmlFile));
foreach ($xml as $key => $value) {
switch ($key) {
case 'prescriber':
$person = new Person();
$person->active = 1;
$person->lastName = (string) $value->PrescriberLastName;
$person->firstName = (string) $value->PrescriberFirstName;
$person->middleName = (string) $value->PrescriberMiddleName;
$person->suffix = (string) $value->PrescriberNameSuffix;
//$person->initials = (string)$value->PrescriberNamePrefix;
$provider = new Provider();
$provider->person = $person;
$provider->sureScriptsSPI = (string) $value->SPI;
$provider->deaNumber = (string) $value->DEANumber;
$provider->stateLicenseNumber = (string) $value->StateLicenseNumber;
$provider->persist();
//ProviderSpecialty, ClinicName
$phone = new PhoneNumber();
$phone->personId = $provider->personId;
$phone->name = 'Primary';
$phone->type = 4;
$phone->number = str_replace('-', '', (string) $value->PrescriberPhone);
$phone->persist();
$address = new Address();
$address->personId = $provider->personId;
$address->name = 'Main';
$address->type = 4;
$address->active = 1;
$address->line1 = (string) $value->ClinicAddressLine1;
$address->line2 = (string) $value->ClinicAddressLine2;
$address->city = (string) $value->ClinicCity;
$address->state = (string) $value->ClinicState;
$address->postalCode = (string) $value->ClinicZip;
$address->persist();
break;
case 'pharmacy':
$pharmacy = new Pharmacy();
$pharmacy->NCPDPID = (string) $value->NCPDPID;
/*$pharmacy-> = (string)$value->ReferenceQualifier;
$pharmacy-> = (string)$value->PharmacistLastName;
$pharmacy-> = (string)$value->PharmacistFirstName;
$pharmacy-> = (string)$value->PharmacistMiddleName;
$pharmacy-> = (string)$value->PharmacistNamePrefix;
$pharmacy-> = (string)$value->PharmacistNameSuffix;*/
$pharmacy->StoreName = (string) $value->PharmacyName;
$pharmacy->AddressLine1 = (string) $value->PharmacyAddressLine1;
$pharmacy->City = (string) $value->PharmacyCity;
$pharmacy->State = (string) $value->PharmacyState;
$pharmacy->Zip = (string) $value->PharmacyZip;
$pharmacy->PhonePrimary = (string) $value->PharmacyPhone;
$pharmacy->persist();
break;
case 'patient':
$person = new Person();
$person->active = 1;
$person->lastName = (string) $value->PatientLastName;
$person->firstName = (string) $value->PatientFirstName;
$person->middleName = (string) $value->PatientMiddleName;
//$person->initials = (string)$value->PatientNamePrefix;
$person->identifier = (string) $value->PatientSS;
$address = new Address();
$address->name = 'Main';
$address->type = 4;
$address->active = 1;
$address->line1 = (string) $value->PatientAddressLine1;
$address->line2 = (string) $value->PatientAddressLine2;
$address->city = (string) $value->PatientCity;
$address->state = (string) $value->PatientState;
$address->postalCode = (string) $value->PatientZip;
$patient = new Patient();
$patient->person = $person;
$patient->homeAddress = $address;
$patient->persist();
$phone = new PhoneNumber();
$phone->personId = $patient->personId;
$phone->name = 'Primary';
$phone->type = 4;
$phone->number = str_replace('-', '', (string) $value->PatientPhone);
$phone->persist();
break;
case 'medication':
break;
}
}
echo 'Done';
die;
}
示例2: processNewPatientAction
public function processNewPatientAction()
{
$params = $this->_getParam('patient');
$patient = new Patient();
$patient->populateWithArray($params);
if (!strlen($patient->recordNumber) > 0) {
$patient->recordNumber = WebVista_Model_ORM::nextSequenceId('record_sequence');
}
$patient->persist();
$personId = (int) $patient->personId;
// save addresses and phones
$addresses = $this->_getParam('addresses');
if (is_array($addresses)) {
foreach ($addresses as $row) {
$address = new Address();
$address->populateWithArray($row);
$address->personId = $personId;
$address->persist();
}
}
$phones = $this->_getParam('phones');
if (is_array($phones)) {
foreach ($phones as $row) {
$phone = new PhoneNumber();
$phone->populateWithArray($row);
$phone->personId = $personId;
$phone->persist();
}
}
$ret = array();
$ret['msg'] = 'Record Saved for Patient: ' . ucfirst($patient->firstName) . ' ' . ucfirst($patient->lastName);
$ret['personId'] = $personId;
$json = Zend_Controller_Action_HelperBroker::getStaticHelper('json');
$json->suppressExit = true;
$json->direct($ret);
}
示例3: processDeleteAction
public function processDeleteAction()
{
$personId = (int) $this->_getParam('personId');
$type = $this->_getParam('type');
$id = (int) $this->_getParam('id');
$obj = null;
switch ($type) {
case 'address':
$obj = new Address();
break;
case 'phone':
$obj = new PhoneNumber();
break;
default:
break;
}
$retVal = false;
if ($obj !== null && $id > 0) {
foreach ($obj->_primaryKeys as $k) {
$obj->{$k} = $id;
}
$obj->setPersistMode(WebVista_Model_ORM::DELETE);
$obj->persist();
$retVal = true;
}
if ($retVal) {
$data = true;
} else {
$data = array('error' => __('There was an error attempting to delete the selected record.'));
}
$json = Zend_Controller_Action_HelperBroker::getStaticHelper('json');
$json->suppressExit = true;
$json->direct($data);
}
示例4: processReorderPhonesAction
public function processReorderPhonesAction()
{
$from = (int) $this->_getParam('from');
$to = (int) $this->_getParam('to');
$ret = false;
if ($from > 0 && $to > 0) {
$phoneFrom = new PhoneNumber();
$phoneFrom->phoneNumberId = $from;
$phoneFrom->populate();
$phoneTo = new PhoneNumber();
$phoneTo->phoneNumberId = $to;
$phoneTo->populate();
// swap displayOrder
$displayOrder = $phoneFrom->displayOrder;
$phoneFrom->displayOrder = $phoneTo->displayOrder;
$phoneTo->displayOrder = $displayOrder;
$phoneFrom->persist();
$phoneTo->persist();
$ret = true;
}
$json = Zend_Controller_Action_HelperBroker::getStaticHelper('json');
$json->suppressExit = true;
$json->direct($ret);
}