src/snac/server/database/DBUser.php
/**
     * Populate a Message Data Object
     *
     * Given a data array, it fills in a message object.
     *
     * @param  string[]  $data               Data array from SQL call
     * @param  boolean $includeBodyContent Whether or not to include the body content
     * @return \snac\data\Message                      Message object
     */
Populate a Message Data Object
Given a data array, it fills in a message object.

@param  string[]  $data               Data array from SQL call
@param  boolean $includeBodyContent Whether or not to include the body content
@return \snac\data\Message                      Message object
Populate a Message Data Object Given a data array it fills in a message object . @param string [] $data Data array from SQL call @param boolean $includeBodyContent Whether or not to include the body content @return \ snac \ data \ Message Message object
public function populateMessage($data, $includeBodyContent=true) {
        if ($data == null)
            return null;
        $message = new \snac\data\Message();
        $message->setID($data["id"]);
        $message->setRead($this->db->pgToBool($data["read"]));
        $message->setToUser($this->readUser(new \snac\data\User(array("userid"=>$data["to_user"]))));
        if ($data["from_user"] != null)
            $message->setFromUser($this->readUser(new \snac\data\User(array("userid"=>$data["from_user"]))));
        else
            $message->setFromString($data["from_string"]);
        $message->setSubject($data["subject"]);
        $message->setTimestamp($data["sent_date"]);
        if ($includeBodyContent) {
            $message->setBody($data["body"]);
            $message->setAttachmentContent($data["attachment_content"]);
            $message->setAttachmentFilename($data["attachment_filename"]);
        }
        return $message;
    }
public function populateMessage ( $ data , $ includeBodyContent = true ) { if ( $ data == null ) return null ; $ message = new \ snac \ data \ Message ( ) ; $ message -> setID ( $ data [ " id " ] ) ; $ message -> setRead ( $ this -> db -> pgToBool ( $ data [ " read " ] ) ) ; $ message -> setToUser ( $ this -> readUser ( new \ snac \ data \ User ( array ( " userid " => $ data [ " to_user " ] ) ) ) ) ; if ( $ data [ " from_user " ] != null ) $ message -> setFromUser ( $ this -> readUser ( new \ snac \ data \ User ( array ( " userid " => $ data [ " from_user " ] ) ) ) ) ; else $ message -> setFromString ( $ data [ " from_string " ] ) ; $ message -> setSubject ( $ data [ " subject " ] ) ; $ message -> setTimestamp ( $ data [ " sent_date " ] ) ; if ( $ includeBodyContent ) { $ message -> setBody ( $ data [ " body " ] ) ; $ message -> setAttachmentContent ( $ data [ " attachment_content " ] ) ; $ message -> setAttachmentFilename ( $ data [ " attachment_filename " ] ) ; } return $ message ; }
Populate a Message Data Object
 Given a data array, it fills in a message object.
Populate a Message Data Object Given a data array it fills in a message object .