コード例 #1
0
 function __construct(Notification $notification)
 {
     $this->id = $notification->getId();
     $this->content = $notification->getContent();
     $this->isRead = $notification->getIsRead();
     $this->createdOn = $notification->getCreatedOn();
 }
コード例 #2
0
 private static function insert(Notification $model)
 {
     $db = DatabaseData::getInstance(\RedDevil\Config\DatabaseConfig::DB_INSTANCE);
     $query = "INSERT INTO notifications (Content,UserId,IsRead,CreatedOn) VALUES (:Content, :UserId, :IsRead, :CreatedOn);";
     $result = $db->prepare($query);
     $result->execute([':Content' => $model->getContent(), ':UserId' => $model->getUserId(), ':IsRead' => $model->getIsRead(), ':CreatedOn' => $model->getCreatedOn()]);
     $model->setId($db->lastInsertId());
 }