3 * Table Definition for message
5 require_once 'DB/DataObject.php';
7 class Message extends DB_DataObject
10 /* the code below is auto generated do not remove the above tag */
12 public $__table = 'message'; // table name
13 public $id; // int(4) primary_key not_null
14 public $uri; // varchar(255) unique_key
15 public $from_profile; // int(4) not_null
16 public $to_profile; // int(4) not_null
17 public $content; // varchar(140)
18 public $rendered; // text()
19 public $url; // varchar(255)
20 public $created; // datetime() not_null
21 public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
22 public $source; // varchar(32)
25 function staticGet($k,$v=NULL) { return DB_DataObject::staticGet('Message',$k,$v); }
27 /* the code above is auto generated do not remove the tag below */
31 return Profile::staticGet('id', $this->from_profile);
35 return Profile::staticGet('id', $this->to_profile);
38 static function saveNew($from, $to, $content, $source) {
42 $msg->from_profile = $from;
43 $msg->to_profile = $to;
44 $msg->content = $content;
45 $msg->rendered = common_render_text($content);
46 $msg->source = $source;
48 $result = $msg->insert();
51 common_log_db_error($msg, 'INSERT', __FILE__);
52 return _('Could not insert message.');
56 $msg->uri = common_local_url('showmessage', array('message' => $message->id));
58 $result = $msg->update($orig);
61 common_log_db_error($msg, 'UPDATE', __FILE__);
62 return _('Could not update message with new URI.');