浏览代码

entidad Action

Guillermo Espinoza 8 年之前
父节点
当前提交
d05b18dd61
共有 2 个文件被更改,包括 201 次插入0 次删除
  1. 148 0
      src/WorkflowBundle/Entity/Action.php
  2. 53 0
      src/WorkflowBundle/Entity/Workflow.php

+ 148 - 0
src/WorkflowBundle/Entity/Action.php

@@ -0,0 +1,148 @@
+<?php
+
+namespace WorkflowBundle\Entity;
+
+use Doctrine\ORM\Mapping as ORM;
+
+/**
+ * @ORM\Table
+ * @ORM\Entity
+ */
+class Action
+{
+
+    /**
+     * @var int
+     *
+     * @ORM\Column(type="integer")
+     * @ORM\Id
+     * @ORM\GeneratedValue(strategy="AUTO")
+     */
+    private $id;
+
+    /**
+     * @var string
+     *
+     * @ORM\Column(type="string", length=255)
+     */
+    private $name;
+
+    /**
+     * @var Workflow
+     * 
+     * @ORM\ManyToOne(targetEntity="Workflow", inversedBy="actions", fetch="EXTRA_LAZY")
+     */
+    private $workflow;
+
+    /**
+     * @var string
+     *
+     * @ORM\Column(type="string", length=255)
+     */
+    private $event;
+
+    /**
+     * @var string
+     *
+     * @ORM\Column(type="string", length=255)
+     */
+    private $template;
+
+    
+    /**
+     * @return string
+     */
+    public function __toString()
+    {
+        return $this->name;
+    }
+
+    /**
+     * @return int
+     */
+    public function getId()
+    {
+        return $this->id;
+    }
+
+    /**
+     * @param string $name
+     *
+     * @return Action
+     */
+    public function setName($name)
+    {
+        $this->name = $name;
+
+        return $this;
+    }
+
+    /**
+     * @return string
+     */
+    public function getName()
+    {
+        return $this->name;
+    }
+
+    /**
+     * @param Workflow $workflow
+     *
+     * @return Action
+     */
+    public function setWorkflow($workflow)
+    {
+        $this->workflow = $workflow;
+
+        return $this;
+    }
+
+    /**
+     * @return Workflow
+     */
+    public function getWorkflow()
+    {
+        return $this->workflow;
+    }
+
+    /**
+     * @param string $event
+     *
+     * @return Action
+     */
+    public function setEvent($event)
+    {
+        $this->event = $event;
+
+        return $this;
+    }
+
+    /**
+     * @return string
+     */
+    public function getEvent()
+    {
+        return $this->event;
+    }
+
+    /**
+     * @param string $template
+     *
+     * @return Action
+     */
+    public function setTemplate($template)
+    {
+        $this->template = $template;
+
+        return $this;
+    }
+
+    /**
+     * @return string
+     */
+    public function getTemplate()
+    {
+        return $this->template;
+    }
+
+}

+ 53 - 0
src/WorkflowBundle/Entity/Workflow.php

@@ -59,6 +59,13 @@ class Workflow
      * @ORM\Column(type="datetime")
      */
     protected $updated;
+    
+    /**
+     * @var ArrayCollection
+     * 
+     * @ORM\OneToMany(targetEntity="Action", mappedBy="workflow")
+     */
+    protected $actions;
 
     /**
      * @var int
@@ -67,6 +74,20 @@ class Workflow
      */
     protected $tenancyId = 1;
     
+    
+    public function __construct()
+    {
+        $this->actions = new \Doctrine\Common\Collections\ArrayCollection();
+    }
+
+    /**
+     * @return string
+     */
+    public function __toString()
+    {
+        return $this->name;
+    }
+    
     /**
      * Get id
      *
@@ -168,6 +189,38 @@ class Workflow
     {
         return $this->updated;
     }
+    
+    /**
+     * @param Action $action
+     * 
+     * @return Workflow
+     */
+    public function addAction(Action $action)
+    {
+        $this->actions[] = $action;
+        
+        return $this;
+    }
+
+    /**
+     * @param Action $action
+     * 
+     * @return Workflow
+     */
+    public function removeAction(Action $action)
+    {
+        $this->actions->removeElement($action);
+        
+        return $this;
+    }
+    
+    /**
+     * @return Doctrine\Common\Collections\Collection 
+     */
+    public function getActions()
+    {
+        return $this->actions;
+    }
 
     /**
      * Set tenancyId