src/Eccube/Entity/Tag.php line 29

Open in your IDE?
  1. <?php
  2. /*
  3. * This file is part of EC-CUBE
  4. *
  5. * Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
  6. *
  7. * http://www.ec-cube.co.jp/
  8. *
  9. * For the full copyright and license information, please view the LICENSE
  10. * file that was distributed with this source code.
  11. */
  12. namespace Eccube\Entity;
  13. use Doctrine\ORM\Mapping as ORM;
  14. if (!class_exists('\Eccube\Entity\Tag')) {
  15. /**
  16. * Tag
  17. *
  18. * @ORM\Table(name="dtb_tag")
  19. * @ORM\InheritanceType("SINGLE_TABLE")
  20. * @ORM\DiscriminatorColumn(name="discriminator_type", type="string", length=255)
  21. * @ORM\HasLifecycleCallbacks()
  22. * @ORM\Entity(repositoryClass="Eccube\Repository\TagRepository")
  23. * @ORM\Cache(usage="NONSTRICT_READ_WRITE")
  24. */
  25. class Tag extends \Eccube\Entity\AbstractEntity
  26. {
  27. /**
  28. * @return string
  29. */
  30. public function __toString()
  31. {
  32. return (string) $this->getName();
  33. }
  34. /**
  35. * @var int
  36. *
  37. * @ORM\Column(name="id", type="integer", options={"unsigned":true})
  38. * @ORM\Id
  39. * @ORM\GeneratedValue(strategy="IDENTITY")
  40. */
  41. protected $id;
  42. /**
  43. * @var string
  44. *
  45. * @ORM\Column(name="name", type="string", length=255)
  46. */
  47. protected $name;
  48. /**
  49. * @var int
  50. *
  51. * @ORM\Column(name="sort_no", type="smallint", options={"unsigned":true})
  52. */
  53. protected $sort_no;
  54. /**
  55. * @var \Doctrine\Common\Collections\Collection
  56. *
  57. * @ORM\OneToMany(targetEntity="Eccube\Entity\ProductTag", mappedBy="Tag")
  58. */
  59. protected $ProductTag;
  60. /**
  61. * Constructor
  62. */
  63. public function __construct()
  64. {
  65. $this->ProductTag = new \Doctrine\Common\Collections\ArrayCollection();
  66. }
  67. /**
  68. * Set id.
  69. *
  70. * @param int $id
  71. *
  72. * @return $this
  73. */
  74. public function setId($id)
  75. {
  76. $this->id = $id;
  77. return $this;
  78. }
  79. /**
  80. * Get id.
  81. *
  82. * @return int
  83. */
  84. public function getId()
  85. {
  86. return $this->id;
  87. }
  88. /**
  89. * Set name.
  90. *
  91. * @param string $name
  92. *
  93. * @return $this
  94. */
  95. public function setName($name)
  96. {
  97. $this->name = $name;
  98. return $this;
  99. }
  100. /**
  101. * Get name.
  102. *
  103. * @return string
  104. */
  105. public function getName()
  106. {
  107. return $this->name;
  108. }
  109. /**
  110. * Set sort_no.
  111. *
  112. * @param int $sort_no
  113. *
  114. * @return $this
  115. */
  116. public function setSortNo($sort_no)
  117. {
  118. $this->sort_no = $sort_no;
  119. return $this;
  120. }
  121. /**
  122. * Get sort_no.
  123. *
  124. * @return int
  125. */
  126. public function getSortNo()
  127. {
  128. return $this->sort_no;
  129. }
  130. /**
  131. * Add productTag.
  132. *
  133. * @param \Eccube\Entity\ProductTag $productTag
  134. *
  135. * @return Tag
  136. */
  137. public function addProductTag(ProductTag $productTag)
  138. {
  139. $this->ProductTag[] = $productTag;
  140. return $this;
  141. }
  142. /**
  143. * Remove productTag.
  144. *
  145. * @param \Eccube\Entity\ProductTag $productTag
  146. *
  147. * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
  148. */
  149. public function removeProductTag(ProductTag $productTag)
  150. {
  151. return $this->ProductTag->removeElement($productTag);
  152. }
  153. /**
  154. * Get productTag.
  155. *
  156. * @return \Doctrine\Common\Collections\Collection
  157. */
  158. public function getProductTag()
  159. {
  160. return $this->ProductTag;
  161. }
  162. }
  163. }