src/Cms/WorkflowsBundle/Entity/WorkflowHistory.php line 26

Open in your IDE?
  1. <?php
  2. /**
  3.  * Created by PhpStorm.
  4.  * User: aron
  5.  * Date: 1/31/18
  6.  * Time: 2:28 PM
  7.  */
  8. namespace Cms\WorkflowsBundle\Entity;
  9. use Cms\TenantBundle\Entity\TenantedEntity;
  10. use Doctrine\ORM\Mapping as ORM;
  11. /**
  12.  * Class WorkflowHistory
  13.  * @package Cms\WorkflowsBundle\Entity
  14.  *
  15.  * @ORM\Entity(
  16.  *     repositoryClass = "Cms\WorkflowsBundle\Doctrine\WorkflowHistoryRepository"
  17.  * )
  18.  * @ORM\Table(
  19.  *     name = "cms__workflows_workflow_history"
  20.  * )
  21.  */
  22. class WorkflowHistory extends TenantedEntity {
  23.     /**
  24.      * @param $status
  25.      */
  26.     public function __construct($status WorkflowSubmission::SUBMISSION_STATUSES__APPROVAL)
  27.     {
  28.         $this->setStatus($status);
  29.     }
  30.     /**
  31.      * @ORM\Id
  32.      * @ORM\Column(type="integer")
  33.      * @ORM\GeneratedValue(strategy="AUTO")
  34.      */
  35.     protected $id;
  36.     /**
  37.      * @var WorkflowSubmission
  38.      *
  39.      * @ORM\ManyToOne(
  40.      *     targetEntity = "Cms\WorkflowsBundle\Entity\WorkflowSubmission",
  41.      * )
  42.      * @ORM\JoinColumn(
  43.      *     name = "content_item",
  44.      *     referencedColumnName = "id",
  45.      *     onDelete = "CASCADE"
  46.      * )
  47.      */
  48.     protected $submission;
  49.     /**
  50.      * mapped from WorkflowSubmission::status
  51.      * when update occurs
  52.      *
  53.      * @var int
  54.      *
  55.      * @ORM\Column(
  56.      *     type = "integer",
  57.      *     nullable = false
  58.      * )
  59.      */
  60.     protected $statusSnapshot WorkflowSubmission::SUBMISSION_STATUSES__APPROVAL;
  61.     /**
  62.      * flag to determine if update contains status change
  63.      *
  64.      * @var int
  65.      *
  66.      * @ORM\Column(
  67.      *     type = "boolean",
  68.      *     nullable = false
  69.      * )
  70.      */
  71.     protected $isStatusChange false;
  72.     /**
  73.      *
  74.      * @var string
  75.      *
  76.      * @ORM\Column(
  77.      *     type = "text",
  78.      *     nullable = true
  79.      * )
  80.      */
  81.     protected $updateComment;
  82.     public function getComment()
  83.     {
  84.         return $this->updateComment;
  85.     }
  86.     public function getStatus()
  87.     {
  88.         return $this->statusSnapshot;
  89.     }
  90.     public function getSubmission()
  91.     {
  92.         return $this->submission;
  93.     }
  94.     /**
  95.      * @param int $status
  96.      * @param bool $isChanged
  97.      * @return $this
  98.      */
  99.     public function setStatus($status$isChanged false)
  100.     {
  101.         $this->isStatusChange $isChanged;
  102.         $this->statusSnapshot $status;
  103.         return $this;
  104.     }
  105.     public function setComment($comment)
  106.     {
  107.         $this->updateComment $comment;
  108.         return $this;
  109.     }
  110.     public function setSubmission($submission)
  111.     {
  112.         $this->submission $submission;
  113.         return $this;
  114.     }
  115. }