PersonCustom.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <?php
  2. namespace Translator\Fixture;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. /**
  6. * @ORM\Entity
  7. */
  8. class PersonCustom
  9. {
  10. /**
  11. * @ORM\Id
  12. * @ORM\GeneratedValue
  13. * @ORM\Column(type="integer")
  14. */
  15. private $id;
  16. /**
  17. * @ORM\Column(name="name", type="string", length=128)
  18. */
  19. private $name;
  20. /**
  21. * @ORM\Column(name="desc", type="string", length=128)
  22. */
  23. private $description;
  24. public function getId()
  25. {
  26. return $this->id;
  27. }
  28. public function setName($name)
  29. {
  30. $this->name = $name;
  31. }
  32. public function getName()
  33. {
  34. return $this->name;
  35. }
  36. public function setDescription($description)
  37. {
  38. $this->description = $description;
  39. }
  40. public function getDescription()
  41. {
  42. return $this->description;
  43. }
  44. //
  45. // TRANSLATIONS DEFINITION:
  46. //
  47. /**
  48. * @ORM\OneToMany(targetEntity="PersonCustomTranslation", mappedBy="translatable", cascade={"persist"})
  49. */
  50. private $translations;
  51. public function __construct()
  52. {
  53. $this->translations = new ArrayCollection();
  54. }
  55. public function translate($locale = null)
  56. {
  57. if (null === $locale) {
  58. return $this;
  59. }
  60. return new CustomProxy($this,
  61. /* Locale */ $locale,
  62. /* List of translatable properties: */ array('name'),
  63. /* Translation entity class: */ 'Translator\Fixture\PersonCustomTranslation',
  64. /* Translations collection property: */ $this->translations
  65. );
  66. }
  67. }