本文整理汇总了PHP中EE_Transaction::get_model方法的典型用法代码示例。如果您正苦于以下问题:PHP EE_Transaction::get_model方法的具体用法?PHP EE_Transaction::get_model怎么用?PHP EE_Transaction::get_model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EE_Transaction
的用法示例。
在下文中一共展示了EE_Transaction::get_model方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: refresh_entity_map
/**
* refresh_entity_map
* simply loops through the current transaction and updates
* each model's entity map using EEM_Base::refresh_entity_map_with()
*
* @access public
* @return bool
*/
protected function refresh_entity_map()
{
// verify the transaction
if ($this->transaction instanceof EE_Transaction && $this->transaction->ID()) {
// never cache payment info
$this->transaction->clear_cache('Payment');
/** @type EE_Transaction_Processor $transaction_processor */
$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
// is the Payment Options Reg Step completed ?
if ($transaction_processor->reg_step_completed($this->transaction, 'payment_options')) {
// then check for payments and update TXN accordingly
/** @type EE_Transaction_Payments $transaction_payments */
$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
$transaction_payments->calculate_total_payments_and_update_status($this->transaction);
}
// grab the saved registrations from the transaction
foreach ($this->transaction->registrations($this->reg_cache_where_params) as $reg_cache_ID => $registration) {
$this->_refresh_registration($reg_cache_ID, $registration);
}
// make sure our cached TXN is added to the model entity mapper
$this->transaction = $this->transaction->get_model()->refresh_entity_map_with($this->transaction->ID(), $this->transaction);
} else {
EE_Error::add_error(__('A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
return FALSE;
}
if ($this->cart instanceof EE_Cart) {
$grand_total = $this->cart->get_grand_total();
if ($grand_total instanceof EE_Line_Item && $grand_total->ID()) {
$grand_total = $grand_total->get_model()->refresh_entity_map_with($this->cart->get_grand_total()->ID(), $this->cart->get_grand_total());
}
if ($grand_total instanceof EE_Line_Item) {
$this->cart = EE_Cart::instance($grand_total);
} else {
EE_Error::add_error(__('A valid Cart was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
return false;
}
}
return TRUE;
}