當前位置: 首頁>>代碼示例>>PHP>>正文


PHP PhoneNumber::populateWithArray方法代碼示例

本文整理匯總了PHP中PhoneNumber::populateWithArray方法的典型用法代碼示例。如果您正苦於以下問題:PHP PhoneNumber::populateWithArray方法的具體用法?PHP PhoneNumber::populateWithArray怎麽用?PHP PhoneNumber::populateWithArray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PhoneNumber的用法示例。


在下文中一共展示了PhoneNumber::populateWithArray方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: processImport2xFacilitiesAction

 public function processImport2xFacilitiesAction()
 {
     $import = (int) $this->_getParam('import');
     $parentId = (int) $this->_getParam('parentId');
     $data = false;
     if ($import > 0 && $parentId > 0) {
         $db = Zend_Registry::get('dbAdapter');
         $enumClosure = new EnumerationsClosure();
         $sql = 'SELECT * FROM practices';
         $practices = $db->fetchAll($sql);
         $ctr = 1;
         foreach ($practices as $practice) {
             $p = new Practice();
             $p->name = $practice['name'];
             $p->website = $practice['website'];
             $p->identifier = $practice['identifier'];
             //$p->persist();
             // add addresses (primary = 4, secondary = 5)
             $sql = 'SELECT * FROM practice_address AS pa INNER JOIN address a ON a.address_id=pa.address_id WHERE pa.practice_id=' . $practice['id'] . ' AND (pa.address_type=4 OR pa.address_type=5)';
             $addresses = $db->fetchAll($sql);
             foreach ($addresses as $address) {
                 if ($address['address_type'] == 4) {
                     $addr = $p->primaryAddress;
                 } else {
                     if ($address['address_type'] == 5) {
                         $addr = $p->secondaryAddress;
                     } else {
                         continue;
                     }
                 }
                 $addr->populateWithArray($address);
                 $addr->addressId = 0;
                 $addr->type = $address['address_type'];
                 $addr->active = 1;
                 $addr->practiceId = $practice['id'];
                 //$addr->persist();
             }
             // add phones (main = 3, secondary = 1, fax = 5)
             $sql = 'SELECT * FROM practice_number AS pn INNER JOIN number n ON n.number_id=pn.number_id WHERE pn.practice_id=' . $practice['id'] . ' AND (n.number_type=1 OR n.number_type=3 OR n.number_type=5)';
             $phones = $db->fetchAll($sql);
             foreach ($phones as $phone) {
                 $pn = new PhoneNumber();
                 $pn->populateWithArray($phone);
                 $pn->type = $phone['number_type'];
                 $pn->numberId = 0;
                 //$pn->persist();
             }
             //$practiceId = $p->practiceId;
             $practiceId = $practice['id'];
             $params = array();
             $params['name'] = $practice['name'];
             $params['key'] = $ctr++;
             $params['active'] = '1';
             $params['ormClass'] = 'Practice';
             $params['ormId'] = $practiceId;
             $params['ormEditMethod'] = 'ormEditMethod';
             $buildingParentId = $enumClosure->insertEnumeration($params, $parentId);
             $sql = 'SELECT * FROM buildings WHERE practice_id=' . $practice['id'];
             $buildings = $db->fetchAll($sql);
             foreach ($buildings as $building) {
                 $b = new Building();
                 $b->description = $building['description'];
                 $b->name = $building['name'];
                 $b->practiceId = $p->practiceId;
                 $b->identifier = $building['identifier'];
                 $b->facilityCodeId = $building['facility_code_id'];
                 //$b->phoneNumber = $building[''];
                 //$b->persist();
                 //$buildingId = $b->buildingId;
                 $buildingId = $building['id'];
                 $params = array();
                 $params['name'] = $building['name'];
                 $params['key'] = $ctr++;
                 $params['active'] = '1';
                 $params['ormClass'] = 'Building';
                 $params['ormId'] = $buildingId;
                 $params['ormEditMethod'] = 'ormEditMethod';
                 $roomParentId = $enumClosure->insertEnumeration($params, $buildingParentId);
                 // add phone number
                 // add address
                 $sql = 'SELECT * FROM building_address AS ba INNER JOIN address a ON a.address_id=ba.address_id WHERE ba.building_id=' . $building['id'];
                 $addresses = $db->fetchAll($sql);
                 foreach ($addresses as $address) {
                     $addr = new Address();
                     $addr->populateWithArray($address);
                     $addr->addressId = 0;
                     $addr->type = $address['address_type'];
                     $addr->active = 1;
                     $addr->practiceId = $practice['id'];
                     //$addr->persist();
                 }
                 $sql = 'SELECT * FROM rooms WHERE building_id=' . $building['id'];
                 $rooms = $db->fetchAll($sql);
                 foreach ($rooms as $room) {
                     $r = new Room();
                     $r->populateWithArray($room);
                     $r->roomId = 0;
                     //$r->persist();
                     //$roomId = $r->roomId;
                     $roomId = $room['id'];
//.........這裏部分代碼省略.........
開發者ID:dragonlet,項目名稱:clearhealth,代碼行數:101,代碼來源:FacilitiesController.php

示例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);
 }
開發者ID:dragonlet,項目名稱:clearhealth,代碼行數:36,代碼來源:PatientNewController.php


注:本文中的PhoneNumber::populateWithArray方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。