src/Entity/Blog.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\BlogRepository;
  4. use DateTime;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Gedmo\Mapping\Annotation as Gedmo;
  8. /**
  9. * @ORM\Entity(repositoryClass=BlogRepository::class)
  10. */
  11. class Blog
  12. {
  13. /**
  14. * @ORM\Id
  15. * @ORM\GeneratedValue
  16. * @ORM\Column(type="integer")
  17. */
  18. private $id;
  19. /**
  20. * @ORM\Column(type="string", length=255)
  21. */
  22. private $name;
  23. /**
  24. * @Gedmo\Slug(fields={"name"})
  25. * @ORM\Column(type="string", length=128, unique=true)
  26. */
  27. private $slug;
  28. /**
  29. * @ORM\OneToOne(targetEntity=Templates::class, cascade={"persist", "remove"})
  30. * @ORM\JoinColumn(nullable=false)
  31. */
  32. private $template;
  33. /**
  34. * @ORM\Column(type="boolean")
  35. */
  36. private $published;
  37. /**
  38. * @ORM\Column(type="json")
  39. */
  40. private $setting = [];
  41. /**
  42. * @ORM\ManyToOne(targetEntity=User::class, inversedBy="blogs")
  43. */
  44. private $created_by;
  45. /**
  46. * @Gedmo\Timestampable(on="create")
  47. * @ORM\Column(type="datetime")
  48. */
  49. private $created_at;
  50. /**
  51. * @Gedmo\Timestampable(on="update")
  52. * @ORM\Column(type="datetime")
  53. */
  54. private $updated_at;
  55. public function __construct()
  56. {
  57. $this->created_by = new ArrayCollection();
  58. }
  59. public function getId(): ?int
  60. {
  61. return $this->id;
  62. }
  63. public function getName(): ?string
  64. {
  65. return $this->name;
  66. }
  67. public function setName(string $name): self
  68. {
  69. $this->name = $name;
  70. return $this;
  71. }
  72. public function getSlug()
  73. {
  74. return $this->slug;
  75. }
  76. public function getPublished(): ?bool
  77. {
  78. return $this->published;
  79. }
  80. public function setPublished(bool $published): self
  81. {
  82. $this->published = $published;
  83. return $this;
  84. }
  85. public function getSetting(): ?array
  86. {
  87. return $this->setting;
  88. }
  89. public function setSetting(array $setting): self
  90. {
  91. $this->setting = [];
  92. return $this;
  93. }
  94. public function getCreatedAt(): ?DateTime
  95. {
  96. return $this->created_at;
  97. }
  98. public function getUpdatedAt(): ?DateTime
  99. {
  100. return $this->updated_at;
  101. }
  102. public function getCreatedBy(): ?User
  103. {
  104. return $this->created_by;
  105. }
  106. public function setCreatedBy(?User $created_by): self
  107. {
  108. $this->created_by = $created_by;
  109. return $this;
  110. }
  111. public function getTemplate(): ?Templates
  112. {
  113. return $this->template;
  114. }
  115. public function setTemplate(Templates $template): self
  116. {
  117. $this->template = $template;
  118. return $this;
  119. }
  120. }