|
@@ -0,0 +1,212 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+namespace WorkflowBundle\Entity;
|
|
|
+
|
|
|
+use Doctrine\ORM\Mapping as ORM;
|
|
|
+use Gedmo\Mapping\Annotation as Gedmo;
|
|
|
+use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
|
|
+use Symfony\Component\Validator\Constraints as Assert;
|
|
|
+use Doctrine\Common\Persistence\Event\LifecycleEventArgs;
|
|
|
+
|
|
|
+/**
|
|
|
+ * Workflow
|
|
|
+ *
|
|
|
+ * @ORM\Entity
|
|
|
+ * @ORM\HasLifecycleCallbacks
|
|
|
+ * @UniqueEntity(fields={"name", "tenancyId"}, message="errors.duplicate_key")
|
|
|
+ * @ORM\Table(uniqueConstraints={@ORM\UniqueConstraint(name="unique_idx", columns={"name", "tenancy_id"})})
|
|
|
+ */
|
|
|
+class Workflow
|
|
|
+{
|
|
|
+ /**
|
|
|
+ * @var int
|
|
|
+ *
|
|
|
+ * @ORM\Column(name="id", type="integer", nullable=false)
|
|
|
+ * @ORM\Id
|
|
|
+ * @ORM\GeneratedValue(strategy="AUTO")
|
|
|
+ */
|
|
|
+ private $id;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @var string
|
|
|
+ *
|
|
|
+ * @ORM\Column(type="string", length=100, nullable=false)
|
|
|
+ */
|
|
|
+ protected $name;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @var string
|
|
|
+ *
|
|
|
+ * @ORM\Column(type="string", length=350, nullable=true)
|
|
|
+ */
|
|
|
+ protected $description;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @var text
|
|
|
+ *
|
|
|
+ * @ORM\Column(type="text", nullable=false)
|
|
|
+ */
|
|
|
+ protected $template;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Gedmo\Timestampable(on="create")
|
|
|
+ * @ORM\Column(type="datetime")
|
|
|
+ */
|
|
|
+ protected $created;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Gedmo\Timestampable(on="update")
|
|
|
+ * @ORM\Column(type="datetime")
|
|
|
+ */
|
|
|
+ protected $updated;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @var int
|
|
|
+ *
|
|
|
+ * @ORM\Column(type="integer", nullable=false, options={"default":1})
|
|
|
+ */
|
|
|
+ protected $tenancyId = 1;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Get id
|
|
|
+ *
|
|
|
+ * @return int
|
|
|
+ */
|
|
|
+ public function getId()
|
|
|
+ {
|
|
|
+ return $this->id;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Set name
|
|
|
+ *
|
|
|
+ * @param string $name
|
|
|
+ *
|
|
|
+ * @return Workflow
|
|
|
+ */
|
|
|
+ public function setName($name)
|
|
|
+ {
|
|
|
+ $this->name = $name;
|
|
|
+
|
|
|
+ return $this;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Get name
|
|
|
+ *
|
|
|
+ * @return string
|
|
|
+ */
|
|
|
+ public function getName()
|
|
|
+ {
|
|
|
+ return $this->name;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Set description
|
|
|
+ *
|
|
|
+ * @param string $description
|
|
|
+ *
|
|
|
+ * @return Workflow
|
|
|
+ */
|
|
|
+ public function setDescription($description)
|
|
|
+ {
|
|
|
+ $this->description = $description;
|
|
|
+
|
|
|
+ return $this;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Get description
|
|
|
+ *
|
|
|
+ * @return string
|
|
|
+ */
|
|
|
+ public function getDescription()
|
|
|
+ {
|
|
|
+ return $this->description;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Set template
|
|
|
+ *
|
|
|
+ * @param text $template
|
|
|
+ *
|
|
|
+ * @return Workflow
|
|
|
+ */
|
|
|
+ public function setTemplate($template)
|
|
|
+ {
|
|
|
+ $this->template = $template;
|
|
|
+
|
|
|
+ return $this;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Get template
|
|
|
+ *
|
|
|
+ * @return text
|
|
|
+ */
|
|
|
+ public function getTemplate()
|
|
|
+ {
|
|
|
+ return $this->template;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Get created
|
|
|
+ *
|
|
|
+ * @return \DateTime
|
|
|
+ */
|
|
|
+ public function getCreated()
|
|
|
+ {
|
|
|
+ return $this->created;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Get updated
|
|
|
+ *
|
|
|
+ * @return \DateTime
|
|
|
+ */
|
|
|
+ public function getUpdated()
|
|
|
+ {
|
|
|
+ return $this->updated;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Set tenancyId
|
|
|
+ *
|
|
|
+ * @param int $tenancyId
|
|
|
+ *
|
|
|
+ * @return Workflow
|
|
|
+ */
|
|
|
+ public function setTenancyId($tenancyId)
|
|
|
+ {
|
|
|
+ $this->tenancyId = $tenancyId;
|
|
|
+
|
|
|
+ return $this;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Get tenancyId
|
|
|
+ *
|
|
|
+ * @return int
|
|
|
+ */
|
|
|
+ public function getTenancyId()
|
|
|
+ {
|
|
|
+ return $this->tenancyId;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @ORM\PostPersist
|
|
|
+ */
|
|
|
+ public function postPersist(LifecycleEventArgs $event)
|
|
|
+ {
|
|
|
+ //Code
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @ORM\PreUpdate
|
|
|
+ */
|
|
|
+ public function postUpdate(LifecycleEventArgs $event)
|
|
|
+ {
|
|
|
+ //Code
|
|
|
+ }
|
|
|
+
|
|
|
+}
|