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


PHP DataMapper::_get_without_auto_populating方法代碼示例

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


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

示例1: _to_object

 /**
  * To Object
  * Copies the values from a query result row to an object.
  * Also initializes that object by running get rules, and
  *   refreshing stored values on the object.
  *
  * Finally, if any "instantiations" are requested, those related objects
  *   are created off of query results
  *
  * This is only public so that the iterator can access it.
  *
  * @ignore
  * @param	DataMapper $item Item to configure
  * @param	object $row Query results
  */
 public function _to_object($item, $row)
 {
     // Populate this object with values from first record
     foreach ($row as $key => $value) {
         $item->{$key} = $value;
     }
     foreach ($this->fields as $field) {
         if (!isset($row->{$field})) {
             $item->{$field} = NULL;
         }
     }
     // Force IDs to integers
     foreach ($this->_field_tracking['intval'] as $field) {
         if (isset($item->{$field})) {
             $item->{$field} = intval($item->{$field});
         }
     }
     if (!empty($this->_field_tracking['get_rules'])) {
         $item->_run_get_rules();
     }
     $item->_refresh_stored_values();
     if ($this->_instantiations) {
         foreach ($this->_instantiations as $related_field => $field_map) {
             // convert fields to a 'row' object
             $row = new stdClass();
             foreach ($field_map as $item_field => $c_field) {
                 $row->{$c_field} = $item->{$item_field};
             }
             // get the related item
             $c =& $item->_get_without_auto_populating($related_field);
             // set the values
             $c->_to_object($c, $row);
             // also set up the ->all array
             $c->all = array();
             $c->all[0] = $c->get_clone();
         }
     }
 }
開發者ID:RVRKC,項目名稱:Hackathon_2015,代碼行數:53,代碼來源:datamapper.php


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