<?php
namespace App\AppBundle\MainBundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use JsonSerializable;
/**
* AddOns
*
* @ORM\Entity
* @ORM\Table(name="support_bug_reporting")
* @ORM\HasLifecycleCallbacks()
*/
class Support_Bug_Reporting implements JsonSerializable
{
/**
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* Many Token have one user. This is the owning side.
* @ORM\ManyToOne(targetEntity="User")
* @ORM\JoinColumn(name="user_id", referencedColumnName="id")
*/
private $user;
/**
* @var Collection
*
* @ORM\ManyToMany(targetEntity="Support_Attachments")
* @ORM\JoinTable(name="support_bug_reporting_attachment",
* joinColumns={@ORM\JoinColumn(name="support_bug_reporting_id", referencedColumnName="id")},
* inverseJoinColumns={@ORM\JoinColumn(name="support_attachment_id", referencedColumnName="id")}
* )
*/
private $attachments;
/**
* @ORM\Column(type="string", length=5000, nullable=false)
* @Assert\NotBlank()
*/
private $message;
/**
* @ORM\Column(type="string", length=1000, nullable=false)
* @Assert\NotBlank()
*/
private $subject;
/**
* Status = 1 - Pending, 2 - In Progress, 3 - Hold, 4 - Completed, 5 - User Not Reachable
* @ORM\Column(type="integer", nullable=false)
* @Assert\NotBlank()
*/
private $status;
/**
* @ORM\Column(type="string", nullable=true)
* @Assert\NotBlank()
*/
private $feedback;
/**
* @ORM\Column(type="string", nullable=true)
* @Assert\NotBlank()
*/
private $device_model;
/**
* @ORM\Column(type="string", nullable=true)
* @Assert\NotBlank()
*/
private $device_id;
/**
* @ORM\Column(type="string", nullable=true)
* @Assert\NotBlank()
*/
private $device_name;
/**
* @ORM\Column(type="integer", nullable=true)
* @Assert\NotBlank()
*/
private $device_type;//0 - iOS, 1 - Android
/**
* @ORM\Column(type="string", nullable=true)
* @Assert\NotBlank()
*/
private $device_os_version;
/**
* @ORM\Column(type="string", nullable=true)
* @Assert\NotBlank()
*/
private $app_version;
/**
* @ORM\Column(type="boolean", nullable=false, options={"default" : 0})
* @Assert\NotBlank()
*/
private $is_read;
/**
* @ORM\Column(type="boolean", nullable=false, options={"default" : 0})
* @Assert\NotBlank()
*/
private $is_fav;
private $user_email;
private $user_phone;
private $user_country_code;
private $user_profile_pic_url;
private $attachment_data = array();
private $user_id;
/**
* @return mixed
*/
public function getId()
{
return $this->id;
}
/**
* @return mixed
*/
public function getUser()
{
return $this->user;
}
/**
* @param mixed $user
*/
public function setUser($user)
{
$this->user = $user;
}
/**
* @return mixed
*/
public function getMessage()
{
return $this->message;
}
/**
* @param mixed $message
*/
public function setMessage($message)
{
$this->message = $message;
}
/**
* @return mixed
*/
public function getSubject()
{
return $this->subject;
}
/**
* @param mixed $subject
*/
public function setSubject($subject)
{
$this->subject = $subject;
}
/**
* @return mixed
*/
public function getStatus()
{
return $this->status;
}
/**
* @param mixed $status
*/
public function setStatus($status)
{
$this->status = $status;
}
/**
* @return mixed
*/
public function getFeedback()
{
return $this->feedback;
}
/**
* @param mixed $feedback
*/
public function setFeedback($feedback)
{
$this->feedback = $feedback;
}
/**
* @return mixed
*/
public function getDeviceModel()
{
return $this->device_model;
}
/**
* @param mixed $device_model
*/
public function setDeviceModel($device_model)
{
$this->device_model = $device_model;
}
/**
* @return mixed
*/
public function getDeviceId()
{
return $this->device_id;
}
/**
* @param mixed $device_id
*/
public function setDeviceId($device_id)
{
$this->device_id = $device_id;
}
/**
* @return mixed
*/
public function getDeviceName()
{
return $this->device_name;
}
/**
* @param mixed $device_name
*/
public function setDeviceName($device_name)
{
$this->device_name = $device_name;
}
/**
* @return mixed
*/
public function getDeviceType()
{
return $this->device_type;
}
/**
* @param mixed $device_type
*/
public function setDeviceType($device_type)
{
$this->device_type = $device_type;
}
/**
* @return mixed
*/
public function getDeviceOsVersion()
{
return $this->device_os_version;
}
/**
* @param mixed $device_os_version
*/
public function setDeviceOsVersion($device_os_version)
{
$this->device_os_version = $device_os_version;
}
/**
* Add Attachment
*
* @param Support_Attachments $attachment
*
* @return Support_Bug_Reporting
*/
public function addSupportAttachment(Support_Attachments $attachment) {
if (!$this->attachments->contains($attachment)) {
$this->attachments->add($attachment);
}
return $this;
}
/**
* Remove Support_Attachments
*
* @param Support_Attachments $attachment
*/
public function removeSupportAttachment(Support_Attachments $attachment) {
$this->attachments->removeElement($attachment);
}
/**
* Get Support_Attachments
*
* @return ArrayCollection
*/
public function getAttachments() {
return $this->attachments;
}
/**
* @return mixed
*/
public function getUserEmail()
{
return $this->user_email;
}
/**
* @param mixed $user_email
*/
public function setUserEmail($user_email)
{
$this->user_email = $user_email;
}
/**
* @return mixed
*/
public function getUserPhone()
{
return $this->user_phone;
}
/**
* @param mixed $user_phone
*/
public function setUserPhone($user_phone)
{
$this->user_phone = $user_phone;
}
/**
* @return mixed
*/
public function getUserCountryCode()
{
return $this->user_country_code;
}
/**
* @param mixed $user_country_code
*/
public function setUserCountryCode($user_country_code)
{
$this->user_country_code = $user_country_code;
}
/**
* @return mixed
*/
public function getUserProfilePicUrl()
{
return $this->user_profile_pic_url;
}
/**
* @param mixed $user_profile_pic_url
*/
public function setUserProfilePicUrl($user_profile_pic_url)
{
$this->user_profile_pic_url = $user_profile_pic_url;
}
/**
* @return mixed
*/
public function getAppVersion()
{
return $this->app_version;
}
/**
* @param mixed $app_version
*/
public function setAppVersion($app_version)
{
$this->app_version = $app_version;
}
/**
* @return array
*/
public function getAttachmentData()
{
return $this->attachment_data;
}
/**
* @param array $attachment_data
*/
public function setAttachmentData(array $attachment_data)
{
$this->attachment_data = $attachment_data;
}
/**
* @return mixed
*/
public function getIsRead()
{
return $this->is_read;
}
/**
* @param mixed $is_read
*/
public function setIsRead($is_read)
{
$this->is_read = $is_read;
}
/**
* @return mixed
*/
public function getIsFav()
{
return $this->is_fav;
}
/**
* @param mixed $is_fav
*/
public function setIsFav($is_fav)
{
$this->is_fav = $is_fav;
}
/**
* @return mixed
*/
public function getUserId()
{
return $this->user_id;
}
/**
* @param mixed $user_id
*/
public function setUserId($user_id)
{
$this->user_id = $user_id;
}
public function jsonSerialize()
{
return array(
'id' => $this->id,
'device_id' => $this->device_id,
'device_model' => $this->device_model,
'device_name' => $this->device_name,
'device_os_version' => $this->device_os_version,
'device_type' => $this->device_type,
'message' => $this->message,
'feedback' => $this->feedback,
'status' => $this->status,
'subject' => $this->subject,
'user_email' => $this->user_email,
'user_mobile' => $this->user_phone,
'user_country_code' => $this->user->getCountryCode(),
'user_name' => $this->user->getFirstName().' '.$this->user->getLastName(),
'user_profile_pic_url' => $this->user_profile_pic_url,
'attachment_data' => $this->attachment_data,
'app_version' => $this->app_version,
'is_read' => $this->is_read,
'is_fav' => $this->is_fav,
'user_id' => $this->user->getId(),
'created' => $this->createdAt->format('Y-m-d H:i:s'),
'updated' => $this->updatedAt->format('Y-m-d H:i:s'),
);
}
/**
* @var \DateTime $created
*
* @ORM\Column(name="created_at", type="datetime", nullable=false)
*/
protected $createdAt;
/**
* @var \DateTime $updated
*
* @ORM\Column(name="updated_at", type="datetime", nullable=false)
*/
protected $updatedAt;
public function getCreatedAt()
{
return $this->createdAt;
}
public function setCreatedAt($createdAt)
{
$this->createdAt = $createdAt;
return $this;
}
public function getUpdatedAt()
{
return $this->updatedAt;
}
public function setUpdatedAt($updatedAt)
{
$this->updatedAt = $updatedAt;
return $this;
}
/**
* @ORM\PrePersist
* @ORM\PreUpdate
*/
public function updatedTimestamps()
{
$this->setUpdatedAt(new \DateTime());
if ($this->getCreatedAt() === null) {
$this->setCreatedAt(new \DateTime());
}
}
public function __construct() {
$this->setCreatedAt(new \DateTime());
$this->attachments = new ArrayCollection();
}
}