Doctrine2WorkFlowAction.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <?php
  2. namespace WorkflowBundle\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\ORM\Mapping as ORM;
  5. /**
  6. * @ORM\Table
  7. * @ORM\Entity(repositoryClass="WorkflowBundle\Repository\Doctrine2WorkFlowActionRepository")
  8. */
  9. class Doctrine2WorkFlowAction
  10. {
  11. /**
  12. * @var int
  13. *
  14. * @ORM\Column(name="id", type="integer")
  15. * @ORM\Id
  16. * @ORM\GeneratedValue(strategy="AUTO")
  17. */
  18. private $id;
  19. /**
  20. * @var string
  21. *
  22. * @ORM\Column(type="string", length=255)
  23. */
  24. private $name;
  25. /**
  26. * @var string
  27. *
  28. * @ORM\Column(type="string", length=255)
  29. */
  30. protected $eventName;
  31. /**
  32. * @var string
  33. *
  34. * @ORM\Column(type="string", length=255)
  35. */
  36. protected $entityClass;
  37. /**
  38. * @var ArrayCollection
  39. *
  40. * @ORM\ManyToMany(targetEntity="Action", mappedBy="doctrine2WorkFlowActions", cascade={"persist"})
  41. */
  42. protected $actions;
  43. /**
  44. * @return string
  45. */
  46. public function __toString()
  47. {
  48. return (string) $this->name;
  49. }
  50. public function __construct()
  51. {
  52. $this->actions = new ArrayCollection();
  53. }
  54. /**
  55. * Get id
  56. *
  57. * @return int
  58. */
  59. public function getId()
  60. {
  61. return $this->id;
  62. }
  63. /**
  64. * @return string
  65. */
  66. public function getName()
  67. {
  68. return $this->name;
  69. }
  70. /**
  71. * @param string $name
  72. *
  73. * @return $this
  74. */
  75. public function setName($name)
  76. {
  77. $this->name = $name;
  78. return $this;
  79. }
  80. /**
  81. * @return string
  82. */
  83. public function getEventName()
  84. {
  85. return $this->eventName;
  86. }
  87. /**
  88. * @param string $eventName
  89. *
  90. * @return $this
  91. */
  92. public function setEventName($eventName)
  93. {
  94. $this->eventName = $eventName;
  95. return $this;
  96. }
  97. /**
  98. * @return string
  99. */
  100. public function getEntityClass()
  101. {
  102. return $this->entityClass;
  103. }
  104. /**
  105. * @param string $entityClass
  106. *
  107. * @return $this
  108. */
  109. public function setEntityClass($entityClass)
  110. {
  111. $this->entityClass = $entityClass;
  112. return $this;
  113. }
  114. /**
  115. * @param Action $action
  116. *
  117. * @return Workflow
  118. */
  119. public function addAction($action)
  120. {
  121. $action->addDoctrine2WorkFlowAction($this);
  122. $this->actions[] = $action;
  123. return $this;
  124. }
  125. /**
  126. * @param Action $action
  127. *
  128. * @return Workflow
  129. */
  130. public function removeAction($action)
  131. {
  132. $action->removeDoctrine2WorkFlowAction($this);
  133. $this->actions->removeElement($action);
  134. return $this;
  135. }
  136. /**
  137. * @return ArrayCollection
  138. */
  139. public function getActions()
  140. {
  141. return $this->actions;
  142. }
  143. }