<?php
/**
* Created by PhpStorm.
* User: aron
* Date: 1/31/18
* Time: 2:28 PM
*/
namespace Cms\WorkflowsBundle\Entity;
use Cms\TenantBundle\Entity\TenantedEntity;
use Doctrine\ORM\Mapping as ORM;
/**
* Class WorkflowHistory
* @package Cms\WorkflowsBundle\Entity
*
* @ORM\Entity(
* repositoryClass = "Cms\WorkflowsBundle\Doctrine\WorkflowHistoryRepository"
* )
* @ORM\Table(
* name = "cms__workflows_workflow_history"
* )
*/
class WorkflowHistory extends TenantedEntity {
/**
* @param $status
*/
public function __construct($status = WorkflowSubmission::SUBMISSION_STATUSES__APPROVAL)
{
$this->setStatus($status);
}
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @var WorkflowSubmission
*
* @ORM\ManyToOne(
* targetEntity = "Cms\WorkflowsBundle\Entity\WorkflowSubmission",
* )
* @ORM\JoinColumn(
* name = "content_item",
* referencedColumnName = "id",
* onDelete = "CASCADE"
* )
*/
protected $submission;
/**
* mapped from WorkflowSubmission::status
* when update occurs
*
* @var int
*
* @ORM\Column(
* type = "integer",
* nullable = false
* )
*/
protected $statusSnapshot = WorkflowSubmission::SUBMISSION_STATUSES__APPROVAL;
/**
* flag to determine if update contains status change
*
* @var int
*
* @ORM\Column(
* type = "boolean",
* nullable = false
* )
*/
protected $isStatusChange = false;
/**
*
* @var string
*
* @ORM\Column(
* type = "text",
* nullable = true
* )
*/
protected $updateComment;
public function getComment()
{
return $this->updateComment;
}
public function getStatus()
{
return $this->statusSnapshot;
}
public function getSubmission()
{
return $this->submission;
}
/**
* @param int $status
* @param bool $isChanged
* @return $this
*/
public function setStatus($status, $isChanged = false)
{
$this->isStatusChange = $isChanged;
$this->statusSnapshot = $status;
return $this;
}
public function setComment($comment)
{
$this->updateComment = $comment;
return $this;
}
public function setSubmission($submission)
{
$this->submission = $submission;
return $this;
}
}