src/Entity/Core/Translations.php line 22

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