AbstractEntity.php 1.9KB

4 лет назад
4 лет назад
4 лет назад
4 лет назад
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <?php
  2. namespace Lc\ShopBundle\Model;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Gedmo\Mapping\Annotation as Gedmo;
  5. use Lc\ShopBundle\Context\UserInterface;
  6. /**
  7. * @ORM\MappedSuperclass
  8. */
  9. abstract class AbstractEntity
  10. {
  11. /**
  12. * @ORM\Column(type="datetime")
  13. * @Gedmo\Timestampable(on="create")
  14. */
  15. protected $createdAt;
  16. /**
  17. * @ORM\Column(type="datetime")
  18. * @Gedmo\Timestampable(on="update")
  19. */
  20. protected $updatedAt;
  21. /**
  22. * @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface")
  23. * @ORM\JoinColumn(nullable=false)
  24. */
  25. protected $createdBy;
  26. /**
  27. * @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface")
  28. * @ORM\JoinColumn(nullable=false)
  29. */
  30. protected $updatedBy;
  31. public function getCreatedAt(): ?\DateTimeInterface
  32. {
  33. return $this->createdAt;
  34. }
  35. public function setCreatedAt(\DateTimeInterface $createdAt): self
  36. {
  37. $this->createdAt = $createdAt;
  38. return $this;
  39. }
  40. public function getUpdatedAt(): ?\DateTimeInterface
  41. {
  42. return $this->updatedAt;
  43. }
  44. public function setUpdatedAt(\DateTimeInterface $updatedAt): self
  45. {
  46. $this->updatedAt = $updatedAt;
  47. return $this;
  48. }
  49. public function getCreatedBy(): ?UserInterface
  50. {
  51. return $this->createdBy;
  52. }
  53. public function setCreatedBy(?UserInterface $createdBy): self
  54. {
  55. $this->createdBy = $createdBy;
  56. return $this;
  57. }
  58. public function getUpdatedBy(): ?UserInterface
  59. {
  60. return $this->updatedBy;
  61. }
  62. public function setUpdatedBy(?UserInterface $updatedBy): self
  63. {
  64. $this->updatedBy = $updatedBy;
  65. return $this;
  66. }
  67. }