コード例 #1
0
 private static function insert(Message $model)
 {
     $db = DatabaseData::getInstance(\RedDevil\Config\DatabaseConfig::DB_INSTANCE);
     $query = "INSERT INTO messages (SenderId,RecipientId,Content,CreatedOn) VALUES (:SenderId, :RecipientId, :Content, :CreatedOn);";
     $result = $db->prepare($query);
     $result->execute([':SenderId' => $model->getSenderId(), ':RecipientId' => $model->getRecipientId(), ':Content' => $model->getContent(), ':CreatedOn' => $model->getCreatedOn()]);
     $model->setId($db->lastInsertId());
 }
コード例 #2
0
 function __construct(Message $message)
 {
     $this->id = $message->getId();
     $this->content = $message->getContent();
     $this->createdOn = $message->getCreatedOn();
 }