/**
  * Adds a gateway log for the specified object, given its ID and type
  * @param string  $message
  * @param mixed $related_obj_id
  * @param string $related_obj_type
  * @throws EE_Error
  * @return EE_Change_Log
  */
 public function gateway_log($message, $related_obj_id, $related_obj_type)
 {
     if (!EE_Registry::instance()->is_model_name($related_obj_type)) {
         throw new EE_Error(sprintf(__("'%s' is not a model name. A model name must be provided when making a gateway log. Eg, 'Payment', 'Payment_Method', etc", "event_espresso"), $related_obj_type));
     }
     $log = EE_Change_Log::new_instance(array('LOG_type' => EEM_Change_Log::type_gateway, 'LOG_message' => $message, 'OBJ_ID' => $related_obj_id, 'OBJ_type' => $related_obj_type));
     $log->save();
     return $log;
 }
 /**
  * @group github-102
  * @group 8589
  */
 public function test_get__serialized_data__twice()
 {
     $log_message = serialize(array('key1' => 'value1', 'key2' => 'value2'));
     $log = EE_Change_Log::new_instance();
     $log->set('LOG_message', $log_message);
     $log->save();
     //verify that when we get its LOG_message its still serialized
     $this->assertTrue(is_array($log->get('LOG_message')));
     $this->assertEquals(unserialize($log_message), $log->get('LOG_message'));
     //now when we get it from the DB, and get its LOG_message, its still serialized
     $log_id = $log->ID();
     EEM_Change_Log::reset();
     unset($log);
     $log_from_db = EEM_Change_Log::instance()->get_one_by_ID($log_id);
     $this->assertTrue(is_array($log_from_db->get('LOG_message')));
     $this->assertEquals(unserialize($log_message), $log_from_db->get('LOG_message'));
 }