145 lines
2.5 KiB
PHP
145 lines
2.5 KiB
PHP
<?php
|
|
|
|
namespace App\Entity;
|
|
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
|
|
|
/**
|
|
* @ORM\Entity
|
|
* @ORM\Table(name="notification", indexes={@ORM\Index(columns={"user_id"})})
|
|
*/
|
|
class Notification
|
|
{
|
|
// unique id
|
|
/**
|
|
* @ORM\Id
|
|
* @ORM\Column(type="integer")
|
|
* @ORM\GeneratedValue(strategy="AUTO")
|
|
*/
|
|
protected $id;
|
|
|
|
// date / time created
|
|
/**
|
|
* @ORM\Column(type="datetime")
|
|
*/
|
|
protected $date_create;
|
|
|
|
// index by user for fast fetching
|
|
// user id (don't link, don't need to)
|
|
/**
|
|
* @ORM\Column(type="integer")
|
|
*/
|
|
protected $user_id;
|
|
|
|
// icon
|
|
/**
|
|
* @ORM\Column(type="string", length=25)
|
|
*/
|
|
protected $icon;
|
|
|
|
// message text
|
|
/**
|
|
* @ORM\Column(type="string", length=300)
|
|
*/
|
|
protected $message;
|
|
|
|
/**
|
|
* @ORM\Column(type="string", length=180)
|
|
*/
|
|
protected $url;
|
|
|
|
// has user read the notification
|
|
/**
|
|
* @ORM\Column(type="boolean")
|
|
*/
|
|
protected $flag_read;
|
|
|
|
// is this still a fresh notification for the user
|
|
/**
|
|
* @ORM\Column(type="boolean")
|
|
*/
|
|
protected $flag_fresh;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->flag_read = false;
|
|
$this->flag_fresh = true;
|
|
}
|
|
|
|
public function getID()
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
public function getDateCreate()
|
|
{
|
|
return $this->date_create;
|
|
}
|
|
|
|
public function setUserID($user_id)
|
|
{
|
|
$this->user_id = $user_id;
|
|
return $this;
|
|
}
|
|
|
|
public function getUserID()
|
|
{
|
|
return $this->user_id;
|
|
}
|
|
|
|
public function setIcon($icon)
|
|
{
|
|
$this->icon = $icon;
|
|
return $this;
|
|
}
|
|
|
|
public function getIcon()
|
|
{
|
|
return $this->icon;
|
|
}
|
|
|
|
public function setMessage($message)
|
|
{
|
|
$this->message = $message;
|
|
return $this;
|
|
}
|
|
|
|
public function getMessage()
|
|
{
|
|
return $this->message;
|
|
}
|
|
|
|
public function setURL($url)
|
|
{
|
|
$this->url = $url;
|
|
return $this;
|
|
}
|
|
|
|
public function getURL()
|
|
{
|
|
return $this->url;
|
|
}
|
|
|
|
public function setIsRead($bool = true)
|
|
{
|
|
$this->flag_read = $bool;
|
|
return $this;
|
|
}
|
|
|
|
public function isRead()
|
|
{
|
|
return $this->flag_read;
|
|
}
|
|
|
|
public function setIsFresh($bool = true)
|
|
{
|
|
$this->flag_fresh = $bool;
|
|
return $this;
|
|
}
|
|
|
|
public function isFresh()
|
|
{
|
|
return $this->flag_fresh;
|
|
}
|
|
}
|