92 lines
2.0KB

  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. * @Gedmo\Blameable(on="create")
  23. * @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface")
  24. * @ORM\JoinColumn(nullable=false)
  25. */
  26. protected $createdBy;
  27. /**
  28. * @Gedmo\Blameable(on="update")
  29. * @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface")
  30. * @ORM\JoinColumn(nullable=false)
  31. */
  32. protected $updatedBy;
  33. public function getCreatedAt(): ?\DateTimeInterface
  34. {
  35. return $this->createdAt;
  36. }
  37. public function setCreatedAt(\DateTimeInterface $createdAt): self
  38. {
  39. $this->createdAt = $createdAt;
  40. return $this;
  41. }
  42. public function getUpdatedAt(): ?\DateTimeInterface
  43. {
  44. return $this->updatedAt;
  45. }
  46. public function setUpdatedAt(\DateTimeInterface $updatedAt): self
  47. {
  48. $this->updatedAt = $updatedAt;
  49. return $this;
  50. }
  51. public function getCreatedBy(): ?UserInterface
  52. {
  53. return $this->createdBy;
  54. }
  55. public function setCreatedBy(?UserInterface $createdBy): self
  56. {
  57. $this->createdBy = $createdBy;
  58. return $this;
  59. }
  60. public function getUpdatedBy(): ?UserInterface
  61. {
  62. return $this->updatedBy;
  63. }
  64. public function setUpdatedBy(?UserInterface $updatedBy): self
  65. {
  66. $this->updatedBy = $updatedBy;
  67. return $this;
  68. }
  69. }