/**
  * Saves the supplied OmniLog Entry to the database.
  *
  * @access  public
  * @param   Omnilog_entry       $entry          The entry to save.
  * @return  Omnilog_entry
  */
 public function save_entry_to_log(Omnilog_entry $entry)
 {
     if (!$entry->is_populated()) {
         throw new Exception($this->_ee->lang->line('exception__save_entry__missing_data'));
     }
     $insert_data = array_merge($entry->to_array(), array('notify_admin' => $entry->get_notify_admin() === TRUE ? 'y' : 'n', 'site_id' => $this->get_site_id()));
     $this->_ee->db->insert('omnilog_entries', $insert_data);
     if (!($insert_id = $this->_ee->db->insert_id())) {
         throw new Exception($this->_ee->lang->line('exception__save_entry__not_saved'));
     }
     $entry->set_log_entry_id($insert_id);
     return $entry;
 }
 public function test__is_populated__not_populated_with_entry_id()
 {
     unset($this->_props['log_entry_id']);
     $subject = new Omnilog_entry($this->_props);
     $this->assertIdentical(FALSE, $subject->is_populated(TRUE));
 }
 /**
  * Saves the supplied OmniLog Entry to the database.
  *
  * @access  public
  * @param   Omnilog_entry       $entry          The entry to save.
  * @return  Omnilog_entry
  */
 public function save_entry_to_log(Omnilog_entry $entry)
 {
     /**
      * This method could conceivably be called when the module is
      * not installed, but the Omnilogger class is present.
      */
     if (!$this->EE->db->table_exists('omnilog_entries')) {
         throw new Exception($this->EE->lang->line('exception__save_entry__not_installed'));
     }
     if (!$entry->is_populated()) {
         throw new Exception($this->EE->lang->line('exception__save_entry__missing_data'));
     }
     $insert_data = array_merge($entry->to_array(), array('notify_admin' => $entry->get_notify_admin() === TRUE ? 'y' : 'n', 'site_id' => $this->get_site_id()));
     $insert_data['admin_emails'] = implode($insert_data['admin_emails'], '|');
     $this->EE->db->insert('omnilog_entries', $insert_data);
     if (!($insert_id = $this->EE->db->insert_id())) {
         throw new Exception($this->EE->lang->line('exception__save_entry__not_saved'));
     }
     $entry->set_log_entry_id($insert_id);
     return $entry;
 }