src/Entity/Web/Site.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Web;
  3. use App\Repository\Web\SiteRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use App\Entity\Behaviors\TranslatableTrait;
  6. use Knp\DoctrineBehaviors\Contract\Entity\TranslatableInterface;
  7. use Locale;
  8. /**
  9. * @ORM\Entity(repositoryClass=SiteRepository::class)
  10. * @ORM\Table(name="web_sites")
  11. * @ORM\EntityListeners({"App\Listener\EntityListener"})
  12. */
  13. class Site implements TranslatableInterface
  14. {
  15. use TranslatableTrait;
  16. /**
  17. * @ORM\Id
  18. * @ORM\GeneratedValue
  19. * @ORM\Column(type="integer")
  20. */
  21. private $id;
  22. /**
  23. * @ORM\Column(type="boolean")
  24. */
  25. private $isPublic;
  26. /**
  27. * @ORM\Column(type="datetime")
  28. */
  29. private $createts;
  30. /**
  31. * @ORM\ManyToOne(targetEntity="App\Entity\User")
  32. * @ORM\JoinColumn(nullable=false)
  33. */
  34. private $createUser;
  35. /**
  36. * @ORM\Column(type="datetime", nullable=true)
  37. */
  38. private $editts;
  39. /**
  40. * @ORM\ManyToOne(targetEntity="App\Entity\User")
  41. */
  42. private $editUser;
  43. public function __construct()
  44. {
  45. $this->setDefaultLocale(Locale::getDefault());
  46. $trans = new SiteTranslation($this->getDefaultLocale());
  47. $this->addTranslation($trans);
  48. }
  49. public function getId(): ?int
  50. {
  51. return $this->id;
  52. }
  53. public function isIsPublic(): ?bool
  54. {
  55. return $this->isPublic;
  56. }
  57. public function setIsPublic(bool $isPublic): self
  58. {
  59. $this->isPublic = $isPublic;
  60. return $this;
  61. }
  62. /**
  63. * @return mixed
  64. */
  65. public function getCreatets()
  66. {
  67. return $this->createts;
  68. }
  69. /**
  70. * @param mixed $createts
  71. */
  72. public function setCreatets($createts): void
  73. {
  74. $this->createts = $createts;
  75. }
  76. /**
  77. * @return mixed
  78. */
  79. public function getCreateUser()
  80. {
  81. return $this->createUser;
  82. }
  83. /**
  84. * @param mixed $createUser
  85. */
  86. public function setCreateUser($createUser): void
  87. {
  88. $this->createUser = $createUser;
  89. }
  90. /**
  91. * @return mixed
  92. */
  93. public function getEditts()
  94. {
  95. return $this->editts;
  96. }
  97. /**
  98. * @param mixed $editts
  99. */
  100. public function setEditts($editts): void
  101. {
  102. $this->editts = $editts;
  103. }
  104. /**
  105. * @return mixed
  106. */
  107. public function getEditUser()
  108. {
  109. return $this->editUser;
  110. }
  111. /**
  112. * @param mixed $editUser
  113. */
  114. public function setEditUser($editUser): void
  115. {
  116. $this->editUser = $editUser;
  117. }
  118. public function __call($method, $arguments)
  119. {
  120. $ret = $this->proxyCurrentLocaleTranslation($method, $arguments);
  121. if(empty($ret)) {
  122. $ret = call_user_func_array( [ $this->translate( Locale::getDefault() ), $method ], $arguments );
  123. }
  124. return $ret;
  125. }
  126. }