You are here

public function Message::__construct in Message 7

Overrides Entity::__construct

File

includes/message.message.inc, line 43
A class used for messages.

Class

Message
@file A class used for messages.

Code

public function __construct($values = array()) {
  if (!isset($values['uid']) && isset($values['user'])) {
    $values['uid'] = $values['user']->uid;
    unset($values['user']);
  }
  if (isset($values['type']) && is_object($values['type'])) {
    $values['type'] = $values['type']->name;
  }
  parent::__construct($values, 'message');
  if (!isset($this->uid)) {
    $this->uid = $GLOBALS['user']->uid;
  }
  if (!isset($this->timestamp)) {
    $this->timestamp = time();
  }
}