<commit_before><?php
/**
 * Table Definition for message
 */
require_once 'DB/DataObject.php';

class Message extends DB_DataObject 
{
    ###START_AUTOCODE
    /* the code below is auto generated do not remove the above tag */

    public $__table = 'message';                         // table name
    public $id;                              // int(4)  primary_key not_null
    public $uri;                             // varchar(255)  unique_key
    public $from_profile;                    // int(4)   not_null
    public $to_profile;                      // int(4)   not_null
    public $content;                         // varchar(140)  
    public $rendered;                        // text()  
    public $url;                             // varchar(255)  
    public $created;                         // datetime()   not_null
    public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
    public $source;                          // varchar(32)  

    /* Static get */
    function staticGet($k,$v=NULL) { return DB_DataObject::staticGet('Message',$k,$v); }

    /* the code above is auto generated do not remove the tag below */
    ###END_AUTOCODE
	
	function getFrom() {
		return Profile::staticGet('id', $this->from_profile);
	}
	
	function getTo() {
		return Profile::staticGet('id', $this->to_profile);
	}
	
	static function saveNew($from, $to, $content, $source) {
		
		$msg = new Message();
		
		$msg->from_profile = $from;
		$msg->to_profile = $to;
		$msg->content = $content;
		$msg->rendered = common_render_text($content);
		$msg->source = $source;
		
		$result = $msg->insert();
		
		if (!$result) {
			common_log_db_error($msg, 'INSERT', __FILE__);
			return _('Could not insert message.');<commit_msg>save created date<commit_after><?php
/**
 * Table Definition for message
 */
require_once 'DB/DataObject.php';

class Message extends DB_DataObject 
{
    ###START_AUTOCODE
    /* the code below is auto generated do not remove the above tag */

    public $__table = 'message';                         // table name
    public $id;                              // int(4)  primary_key not_null
    public $uri;                             // varchar(255)  unique_key
    public $from_profile;                    // int(4)   not_null
    public $to_profile;                      // int(4)   not_null
    public $content;                         // varchar(140)  
    public $rendered;                        // text()  
    public $url;                             // varchar(255)  
    public $created;                         // datetime()   not_null
    public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
    public $source;                          // varchar(32)  

    /* Static get */
    function staticGet($k,$v=NULL) { return DB_DataObject::staticGet('Message',$k,$v); }

    /* the code above is auto generated do not remove the tag below */
    ###END_AUTOCODE
	
	function getFrom() {
		return Profile::staticGet('id', $this->from_profile);
	}
	
	function getTo() {
		return Profile::staticGet('id', $this->to_profile);
	}
	
	static function saveNew($from, $to, $content, $source) {
		
		$msg = new Message();
		
		$msg->from_profile = $from;
		$msg->to_profile = $to;
		$msg->content = $content;
		$msg->rendered = common_render_text($content);
		$msg->created = common_sql_now();
		$msg->source = $source;
		
		$result = $msg->insert();
		
		if (!$result) {
			common_log_db_error($msg, 'INSERT', __FILE__);
			return _('Could not insert message.');
{'fraction_non_alphanumeric': 0.12815479528883902, 'fraction_numerical': 0.007851934941110488, 'mean_word_length': 1.883589329021827, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3470102', 'n_tokens_mistral': 1097, 'n_tokens_neox': 999, 'n_words': 257}