当前位置: 首页>>代码示例>>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;未经允许,请勿转载。