<?php
namespace MedBrief\MSR\Entity;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
/**
* DiscImportSession
*
* @ORM\Table(name="DiscImportSession")
*
* @ORM\Entity
*
* @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false)
*/
class DiscImportSession
{
public const STATUS_SUCCESS = 1;
public const STATUS_FAIL = 2;
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
*
* @ORM\Id
*
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* @var \DateTime|null
*
* @ORM\Column(name="deletedAt", type="datetime", nullable=true)
*/
private $deletedAt;
/**
* @var \DateTime
*
* @ORM\Column(name="created", type="datetime")
*
* @Gedmo\Timestampable(on="create")
*/
private $created;
/**
* @var \DateTime
*
* @ORM\Column(name="updated", type="datetime")
*
* @Gedmo\Timestampable(on="update")
*/
private $updated;
/**
* @var int
*
* @ORM\Column(name="status", type="integer", nullable=false)
*/
private $status;
/**
* @var DocumentImportSession
*
* @ORM\OneToOne(targetEntity="MedBrief\MSR\Entity\DocumentImportSession", cascade={"all"})
*
* @ORM\JoinColumns({
*
* @ORM\JoinColumn(name="document_import_session_id", referencedColumnName="id", unique=true)
* })
*/
private $documentImportSession;
/**
* @var \Doctrine\Common\Collections\Collection
*
* @ORM\OneToMany(targetEntity="MedBrief\MSR\Entity\DiscImportSessionItem", mappedBy="discImportSession", cascade={"persist","remove"})
*/
private $discImportSessionItems;
/**
* @var Project
*
* @ORM\ManyToOne(targetEntity="MedBrief\MSR\Entity\Project", inversedBy="discImportSessions")
*
* @ORM\JoinColumns({
*
* @ORM\JoinColumn(name="project_id", referencedColumnName="id", nullable=false)
* })
*/
private $project;
/**
* @var User
*
* @ORM\ManyToOne(targetEntity="MedBrief\MSR\Entity\User", inversedBy="discImportSessions")
*
* @ORM\JoinColumns({
*
* @ORM\JoinColumn(name="creator_id", referencedColumnName="id", nullable=false)
* })
*/
private $creator;
/**
* @var Disc
*
* @ORM\ManyToOne(targetEntity="MedBrief\MSR\Entity\Disc", inversedBy="discImportSessions")
*
* @ORM\JoinColumns({
*
* @ORM\JoinColumn(name="disc_id", referencedColumnName="id", nullable=false)
* })
*/
private $disc;
/**
* Constructor
*/
public function __construct()
{
// default fail status until we update it to SUCCESS right at the end
$this->setStatus(self::STATUS_FAIL);
$this->discImportSessionItems = new \Doctrine\Common\Collections\ArrayCollection();
}
public function __toString()
{
return (string) $this->getId();
}
/**
* Get id
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Set deletedAt
*
* @param \DateTime $deletedAt
*
* @return DiscImportSession
*/
public function setDeletedAt($deletedAt)
{
$this->deletedAt = $deletedAt;
return $this;
}
/**
* Get deletedAt
*
* @return \DateTime
*/
public function getDeletedAt()
{
return $this->deletedAt;
}
/**
* Set created
*
* @param \DateTime $created
*
* @return DiscImportSession
*/
public function setCreated($created)
{
$this->created = $created;
return $this;
}
/**
* Get created
*
* @return \DateTime
*/
public function getCreated()
{
return $this->created;
}
/**
* Set updated
*
* @param \DateTime $updated
*
* @return DiscImportSession
*/
public function setUpdated($updated)
{
$this->updated = $updated;
return $this;
}
/**
* Get updated
*
* @return \DateTime
*/
public function getUpdated()
{
return $this->updated;
}
/**
* Set status
*
* @param int $status
*
* @return DiscImportSession
*/
public function setStatus($status)
{
$this->status = $status;
return $this;
}
/**
* Get status
*
* @return int
*/
public function getStatus()
{
return $this->status;
}
/**
* Set project
*
* @param Project $project
*
* @return DiscImportSession
*/
public function setProject(Project $project)
{
$this->project = $project;
return $this;
}
/**
* Get project
*
* @return Project
*/
public function getProject()
{
return $this->project;
}
/**
* Set creator
*
* @param User $creator
*
* @return DiscImportSession
*/
public function setCreator(User $creator)
{
$this->creator = $creator;
return $this;
}
/**
* Get creator
*
* @return User
*/
public function getCreator()
{
return $this->creator;
}
/**
* Set disc
*
* @param Disc $disc
*
* @return DiscImportSession
*/
public function setDisc(Disc $disc)
{
$this->disc = $disc;
return $this;
}
/**
* Get disc
*
* @return Disc
*/
public function getDisc()
{
return $this->disc;
}
/**
* Add discImportSessionItem
*
* @param DiscImportSessionItem $discImportSessionItem
*
* @return DiscImportSession
*/
public function addDiscImportSessionItem(DiscImportSessionItem $discImportSessionItem)
{
$this->discImportSessionItems[] = $discImportSessionItem;
return $this;
}
/**
* Remove discImportSessionItem
*
* @param DiscImportSessionItem $discImportSessionItem
*/
public function removeDiscImportSessionItem(DiscImportSessionItem $discImportSessionItem)
{
$this->discImportSessionItems->removeElement($discImportSessionItem);
}
/**
* Get discImportSessionItems
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getDiscImportSessionItems()
{
return $this->discImportSessionItems;
}
/**
* Set documentImportSession
*
* @param DocumentImportSession $documentImportSession
*
* @return DiscImportSession
*/
public function setDocumentImportSession(?DocumentImportSession $documentImportSession = null)
{
$this->documentImportSession = $documentImportSession;
return $this;
}
/**
* Get documentImportSession
*
* @return DocumentImportSession
*/
public function getDocumentImportSession()
{
return $this->documentImportSession;
}
}