src/Entity/Core/Translations.php line 21

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Core;
  3. use Doctrine\DBAL\Types\Types;
  4. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  5. use Symfony\Component\Validator\Constraints as Assert;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  8. use Symfony\Component\HttpFoundation\File\File;
  9. use Symfony\Component\HttpFoundation\File\UploadedFile;
  10. use Vich\UploaderBundle\Entity\File as EmbeddedFile;
  11. /**
  12. * Translations
  13. *
  14. * @ORM\Table("core_translations")
  15. * @ORM\Entity(repositoryClass="App\Repository\Core\TranslationsRepository")
  16. * @ORM\HasLifecycleCallbacks()
  17. */
  18. class Translations
  19. {
  20. /**
  21. * @var integer
  22. *
  23. * @ORM\Column(name="id", type="integer")
  24. * @ORM\Id
  25. * @ORM\GeneratedValue(strategy="AUTO")
  26. */
  27. protected $id;
  28. /**
  29. * @var string
  30. *
  31. * @ORM\Column(name="created_at", type="datetime", nullable=true, options={"comment":"Date de création"})
  32. */
  33. private $createdAt;
  34. /**
  35. * @var string
  36. *
  37. * @ORM\Column(name="updated_at", type="datetime", nullable=true, options={"comment":"Date de mise à jour"})
  38. */
  39. private $updatedAt;
  40. /**
  41. * @var string
  42. *
  43. * @ORM\Column(name="locale", type="string", length=11, nullable=true)
  44. */
  45. private $locale;
  46. /**
  47. * @var string
  48. *
  49. * @ORM\Column(name="keypair", type="text", nullable=true)
  50. */
  51. private $key;
  52. /**
  53. * @var string
  54. *
  55. * @ORM\Column(name="value", type="text", nullable=true)
  56. */
  57. private $value;
  58. /**
  59. * @ORM\PrePersist
  60. */
  61. public function setCreatedAtValue(): void
  62. {
  63. $this->setCreatedAt(new \DateTime("now"));
  64. $this->setUpdatedAt(new \DateTime("now"));
  65. }
  66. /**
  67. * @ORM\PreUpdate
  68. */
  69. public function setUpdatedAtValue(): void
  70. {
  71. $this->setUpdatedAt(new \DateTime("now"));
  72. }
  73. public function __toString()
  74. {
  75. if(!empty($this->getValue())) {
  76. return $this->getValue();
  77. }
  78. return (string)$this->getKey();
  79. }
  80. public function getId(): ?int
  81. {
  82. return $this->id;
  83. }
  84. public function getCreatedAt(): ?\DateTimeInterface
  85. {
  86. return $this->createdAt;
  87. }
  88. public function setCreatedAt(?\DateTimeInterface $createdAt): self
  89. {
  90. $this->createdAt = $createdAt;
  91. return $this;
  92. }
  93. public function getUpdatedAt(): ?\DateTimeInterface
  94. {
  95. return $this->updatedAt;
  96. }
  97. public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
  98. {
  99. $this->updatedAt = $updatedAt;
  100. return $this;
  101. }
  102. public function getLocale(): ?string
  103. {
  104. return $this->locale;
  105. }
  106. public function setLocale(?string $locale): self
  107. {
  108. $this->locale = $locale;
  109. return $this;
  110. }
  111. public function getKey(): ?string
  112. {
  113. return $this->key;
  114. }
  115. public function setKey(?string $key): self
  116. {
  117. $this->key = $key;
  118. return $this;
  119. }
  120. public function getValue(): ?string
  121. {
  122. return $this->value;
  123. }
  124. public function setValue(?string $value): self
  125. {
  126. $this->value = $value;
  127. return $this;
  128. }
  129. }