Advertisement
Guest User

Untitled

a guest
Sep 21st, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.14 KB | None | 0 0
  1. <?php
  2.  
  3. namespace AppBundle\Entity;
  4.  
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Oro\Bundle\EntityConfigBundle\Metadata\Annotation\Config;
  7.  
  8. /**
  9. * LeadCooperation
  10. *
  11. * @ORM\Table(
  12. * name="app_lead_cooperation",
  13. * uniqueConstraints={
  14. * @ORM\UniqueConstraint(name="app_lead_cooperation_unique_idx", columns={"key"})
  15. * }
  16. * )
  17. * @ORM\Entity(repositoryClass="AppBundle\Entity\Repository\LeadCooperationRepository")
  18. *
  19. * @ORM\HasLifecycleCallbacks()
  20. *
  21. * @Config(
  22. * routeName="app_lead_cooperation_index",
  23. * routeView="app_lead_cooperation_view",
  24. * defaultValues={
  25. * "form"={
  26. * "grid_name"="app-lead-cooperation-grid",
  27. * }
  28. * }
  29. * )
  30. */
  31. class LeadCooperation
  32. {
  33.  
  34. /**
  35. * @ORM\Id
  36. * @var string
  37. *
  38. * @ORM\Column(name="key", type="string", length=255, nullable=false, unique=true)
  39. */
  40. protected $key;
  41.  
  42. /**
  43. * @var string
  44. *
  45. * @ORM\Column(name="name", type="string", length=255, nullable=false)
  46. */
  47. protected $name;
  48.  
  49. /**
  50. * @var \DateTime
  51. *
  52. * @ORM\Column(name="created_at", type="datetime")
  53. */
  54. protected $createdAt;
  55.  
  56. /**
  57. * @var \DateTime
  58. *
  59. * @ORM\Column(name="updated_at", type="datetime")
  60. */
  61. protected $updatedAt;
  62.  
  63. /**
  64. * @return string
  65. */
  66. public function getKey()
  67. {
  68. return $this->key;
  69. }
  70.  
  71. /**
  72. * @param string $key
  73. *
  74. * @return LeadCooperation
  75. */
  76. public function setKey($key)
  77. {
  78. $this->key = $key;
  79.  
  80. return $this;
  81. }
  82.  
  83. /**
  84. * @return string
  85. */
  86. public function getName()
  87. {
  88. return $this->name;
  89. }
  90.  
  91. /**
  92. * @param string $name
  93. *
  94. * @return LeadCooperation
  95. */
  96. public function setName($name)
  97. {
  98. $this->name = $name;
  99.  
  100. return $this;
  101. }
  102.  
  103. /**
  104. * Set createdAt
  105. *
  106. * @param \DateTime $createdAt
  107. *
  108. * @return LeadCooperation
  109. */
  110. public function setCreatedAt(\DateTime $createdAt)
  111. {
  112. $this->createdAt = $createdAt;
  113.  
  114. return $this;
  115. }
  116.  
  117. /**
  118. * Get createdAt
  119. *
  120. * @return \DateTime
  121. */
  122. public function getCreatedAt()
  123. {
  124. return $this->createdAt;
  125. }
  126.  
  127. /**
  128. * Set updatedAt
  129. *
  130. * @param \DateTime $updatedAt
  131. *
  132. * @return LeadCooperation
  133. */
  134. public function setUpdatedAt(\DateTime $updatedAt)
  135. {
  136. $this->updatedAt = $updatedAt;
  137.  
  138. return $this;
  139. }
  140.  
  141. /**
  142. * Get updatedAt
  143. *
  144. * @return \DateTime
  145. */
  146. public function getUpdatedAt()
  147. {
  148. return $this->updatedAt;
  149. }
  150.  
  151. /**
  152. * Pre persist event listener
  153. *
  154. * @ORM\PrePersist
  155. */
  156. public function beforeSave()
  157. {
  158. $this->setCreatedAt(new \DateTime('now', new \DateTimeZone('UTC')));
  159. $this->beforeUpdate();
  160. }
  161.  
  162. /**
  163. * Pre update event handler
  164. *
  165. * @ORM\PreUpdate
  166. */
  167. public function beforeUpdate()
  168. {
  169. $this->setUpdatedAt(new \DateTime('now', new \DateTimeZone('UTC')));
  170. }
  171.  
  172. /**
  173. * @return string
  174. */
  175. public function __toString()
  176. {
  177. return $this->getName();
  178. }
  179. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement