vendor/perfectneeds/seo-multi-lang-bundle/Entity/SeoSocial.php line 15

Open in your IDE?
  1. <?php
  2. namespace PN\SeoBundle\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use PN\LocaleBundle\Model\Translatable;
  5. use PN\LocaleBundle\Model\LocaleTrait;
  6. /**
  7. * SeoSocial
  8. *
  9. * @ORM\Table(name="seo_social")
  10. * @ORM\Entity(repositoryClass="PN\SeoBundle\Repository\SeoSocialRepository")
  11. */
  12. class SeoSocial implements Translatable {
  13. use LocaleTrait;
  14. const FACEBOOK = 1;
  15. const TWITTER = 2;
  16. public static $socialNetworks = [
  17. ["name" => "Facebook", "icon" => "icon-facebook", "type" => self::FACEBOOK],
  18. ["name" => "Twitter", "icon" => "icon-twitter", "type" => self::TWITTER],
  19. ];
  20. /**
  21. * @var int
  22. *
  23. * @ORM\Column(name="id", type="integer")
  24. * @ORM\Id
  25. * @ORM\GeneratedValue(strategy="AUTO")
  26. */
  27. private $id;
  28. /**
  29. * @var string
  30. *
  31. * @ORM\Column(name="title", type="string", length=255, nullable=true)
  32. */
  33. private $title;
  34. /**
  35. * @var string
  36. *
  37. * @ORM\Column(name="description", type="text",nullable=true)
  38. */
  39. private $description;
  40. /**
  41. * @var string
  42. *
  43. * @ORM\Column(name="image_url", type="string", length=255,nullable=true)
  44. */
  45. private $imageUrl;
  46. /**
  47. * @var int
  48. *
  49. * @ORM\Column(name="social_network", type="smallint",nullable=true)
  50. */
  51. private $socialNetwork;
  52. /**
  53. * @ORM\OneToMany(targetEntity="PN\SeoBundle\Entity\Translation\SeoSocialTranslation", mappedBy="translatable", cascade={"ALL"}, orphanRemoval=true)
  54. */
  55. protected $translations;
  56. /**
  57. * Constructor
  58. */
  59. public function __construct() {
  60. $this->translations = new \Doctrine\Common\Collections\ArrayCollection();
  61. }
  62. /**
  63. * Get id
  64. *
  65. * @return int
  66. */
  67. public function getId() {
  68. return $this->id;
  69. }
  70. /**
  71. * Set title
  72. *
  73. * @param string $title
  74. *
  75. * @return SeoSocial
  76. */
  77. public function setTitle($title) {
  78. $this->title = $title;
  79. return $this;
  80. }
  81. /**
  82. * Get title
  83. *
  84. * @return string
  85. */
  86. public function getTitle() {
  87. return !$this->currentTranslation ? $this->title : $this->currentTranslation->getTitle();
  88. }
  89. /**
  90. * Set description
  91. *
  92. * @param string $description
  93. *
  94. * @return SeoSocial
  95. */
  96. public function setDescription($description) {
  97. $this->description = $description;
  98. return $this;
  99. }
  100. /**
  101. * Get description
  102. *
  103. * @return string
  104. */
  105. public function getDescription() {
  106. return !$this->currentTranslation ? $this->description : $this->currentTranslation->getDescription();
  107. }
  108. /**
  109. * Set imageUrl
  110. *
  111. * @param string $imageUrl
  112. *
  113. * @return SeoSocial
  114. */
  115. public function setImageUrl($imageUrl) {
  116. $this->imageUrl = $imageUrl;
  117. return $this;
  118. }
  119. /**
  120. * Get imageUrl
  121. *
  122. * @return string
  123. */
  124. public function getImageUrl() {
  125. return !$this->currentTranslation ? $this->imageUrl : $this->currentTranslation->getImageUrl();
  126. }
  127. /**
  128. * Set socialNetwork
  129. *
  130. * @param integer $socialNetwork
  131. *
  132. * @return SeoSocial
  133. */
  134. public function setSocialNetwork($socialNetwork) {
  135. $this->socialNetwork = $socialNetwork;
  136. return $this;
  137. }
  138. /**
  139. * Get socialNetwork
  140. *
  141. * @return int
  142. */
  143. public function getSocialNetwork() {
  144. return $this->socialNetwork;
  145. }
  146. /**
  147. * Set seo
  148. *
  149. * @param \PN\SeoBundle\Entity\Seo $seo
  150. *
  151. * @return SeoSocial
  152. */
  153. public function setSeo(\PN\SeoBundle\Entity\Seo $seo = null) {
  154. $this->seo = $seo;
  155. return $this;
  156. }
  157. /**
  158. * Get seo
  159. *
  160. * @return \PN\SeoBundle\Entity\Seo
  161. */
  162. public function getSeo() {
  163. return $this->seo;
  164. }
  165. }