vendor/lexik/translation-bundle/Entity/Translation.php line 15

Open in your IDE?
  1. <?php
  2. namespace Lexik\Bundle\TranslationBundle\Entity;
  3. use DateTime;
  4. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  5. use Lexik\Bundle\TranslationBundle\Model\Translation as TranslationModel;
  6. use Lexik\Bundle\TranslationBundle\Manager\TranslationInterface;
  7. /**
  8. * @UniqueEntity(fields={"transUnit", "locale"})
  9. *
  10. * @author Cédric Girard <c.girard@lexik.fr>
  11. */
  12. class Translation extends TranslationModel implements TranslationInterface
  13. {
  14. /**
  15. * @var int
  16. */
  17. protected $id;
  18. /**
  19. * @var TransUnit
  20. */
  21. protected $transUnit;
  22. /**
  23. * Get id
  24. *
  25. * @return integer
  26. */
  27. public function getId()
  28. {
  29. return $this->id;
  30. }
  31. /**
  32. * Set transUnit
  33. *
  34. * @param TransUnit $transUnit
  35. */
  36. public function setTransUnit(\Lexik\Bundle\TranslationBundle\Model\TransUnit $transUnit)
  37. {
  38. $this->transUnit = $transUnit;
  39. }
  40. /**
  41. * Get transUnit
  42. *
  43. * @return TransUnit
  44. */
  45. public function getTransUnit()
  46. {
  47. return $this->transUnit;
  48. }
  49. /**
  50. * {@inheritdoc}
  51. */
  52. public function prePersist()
  53. {
  54. $now = new DateTime("now");
  55. $this->createdAt = $now;
  56. $this->updatedAt = $now;
  57. }
  58. public function preUpdate()
  59. {
  60. $this->updatedAt = new DateTime("now");
  61. }
  62. }