/** * 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; }