本文整理匯總了PHP中DataMapper::_run_get_rules方法的典型用法代碼示例。如果您正苦於以下問題:PHP DataMapper::_run_get_rules方法的具體用法?PHP DataMapper::_run_get_rules怎麽用?PHP DataMapper::_run_get_rules使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DataMapper
的用法示例。
在下文中一共展示了DataMapper::_run_get_rules方法的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();
}
}
}