AbstractEntity.php 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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\GlobalParamInterface;
  6. use Lc\ShopBundle\Context\UserInterface;
  7. use Lc\ShopBundle\Services\Utils;
  8. /**
  9. * @ORM\MappedSuperclass
  10. */
  11. abstract class AbstractEntity
  12. {
  13. /**
  14. * @ORM\Column(type="datetime")
  15. * @Gedmo\Timestampable(on="create")
  16. */
  17. protected $createdAt;
  18. /**
  19. * @ORM\Column(type="datetime")
  20. * @Gedmo\Timestampable(on="update")
  21. */
  22. protected $updatedAt;
  23. /**
  24. * @Gedmo\Blameable(on="create")
  25. * @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface")
  26. * @ORM\JoinColumn(nullable=false)
  27. */
  28. protected $createdBy;
  29. /**
  30. * @Gedmo\Blameable(on="update")
  31. * @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface")
  32. * @ORM\JoinColumn(nullable=false)
  33. */
  34. protected $updatedBy;
  35. public function getCreatedAt(): ?\DateTimeInterface
  36. {
  37. return $this->createdAt;
  38. }
  39. public function setCreatedAt(\DateTimeInterface $createdAt): self
  40. {
  41. $this->createdAt = $createdAt;
  42. return $this;
  43. }
  44. public function getUpdatedAt(): ?\DateTimeInterface
  45. {
  46. return $this->updatedAt;
  47. }
  48. public function setUpdatedAt(\DateTimeInterface $updatedAt): self
  49. {
  50. $this->updatedAt = $updatedAt;
  51. return $this;
  52. }
  53. public function getCreatedBy(): ?UserInterface
  54. {
  55. return $this->createdBy;
  56. }
  57. public function setCreatedBy(?UserInterface $createdBy): self
  58. {
  59. $this->createdBy = $createdBy;
  60. return $this;
  61. }
  62. public function getUpdatedBy(): ?UserInterface
  63. {
  64. return $this->updatedBy;
  65. }
  66. public function setUpdatedBy(?UserInterface $updatedBy): self
  67. {
  68. $this->updatedBy = $updatedBy;
  69. return $this;
  70. }
  71. }