PageRenderTime 56ms CodeModel.GetById 20ms RepoModel.GetById 1ms app.codeStats 0ms

/www/shop/engine/Shopware/Models/Article/Link.php

https://bitbucket.org/weberlars/sot-shopware
PHP | 215 lines | 64 code | 18 blank | 133 comment | 0 complexity | 43507ad263260cb44bfdf8d4b451b081 MD5 | raw file
Possible License(s): AGPL-3.0, MIT, BSD-3-Clause, LGPL-2.1, LGPL-3.0
  1. <?php
  2. /**
  3. * Shopware 4.0
  4. * Copyright Š 2012 shopware AG
  5. *
  6. * According to our dual licensing model, this program can be used either
  7. * under the terms of the GNU Affero General Public License, version 3,
  8. * or under a proprietary license.
  9. *
  10. * The texts of the GNU Affero General Public License with an additional
  11. * permission and of our proprietary license can be found at and
  12. * in the LICENSE file you have received along with this program.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU Affero General Public License for more details.
  18. *
  19. * "Shopware" is a registered trademark of shopware AG.
  20. * The licensing of the program under the AGPLv3 does not imply a
  21. * trademark license. Therefore any rights, title and interest in
  22. * our trademarks remain entirely with us.
  23. *
  24. * @category Shopware
  25. * @package Shopware_Models
  26. * @subpackage Article
  27. * @copyright Copyright (c) 2012, shopware AG (http://www.shopware.de)
  28. * @version $Id$
  29. * @author $Author$
  30. */
  31. namespace Shopware\Models\Article;
  32. use Shopware\Components\Model\ModelEntity,
  33. Doctrine\ORM\Mapping AS ORM,
  34. Symfony\Component\Validator\Constraints as Assert,
  35. Doctrine\Common\Collections\ArrayCollection;
  36. /**
  37. * todo@all: Documentation
  38. *
  39. * @ORM\Table(name="s_articles_information")
  40. * @ORM\Entity
  41. */
  42. class Link extends ModelEntity
  43. {
  44. /**
  45. * @var integer $id
  46. *
  47. * @ORM\Column(name="id", type="integer", nullable=false)
  48. * @ORM\Id
  49. * @ORM\GeneratedValue(strategy="IDENTITY")
  50. */
  51. private $id;
  52. /**
  53. * @ORM\Column(name="articleID", type="integer", nullable=false)
  54. * @var
  55. */
  56. private $articleId;
  57. /**
  58. * @Assert\NotBlank
  59. *
  60. * @var string $description
  61. *
  62. * @ORM\Column(name="description", type="string", nullable=false)
  63. */
  64. private $name;
  65. /**
  66. * @Assert\NotBlank
  67. * @Assert\Url
  68. *
  69. * @var string $link
  70. *
  71. * @ORM\Column(name="link", type="string", nullable=false)
  72. */
  73. private $link;
  74. /**
  75. * @var string $target
  76. *
  77. * @ORM\Column(name="target", type="string", nullable=false)
  78. */
  79. private $target = '_blank';
  80. /**
  81. * OWNING SIDE
  82. * @var \Shopware\Models\Article\Article
  83. * @ORM\ManyToOne(targetEntity="Shopware\Models\Article\Article", inversedBy="links")
  84. * @ORM\JoinColumn(name="articleID", referencedColumnName="id")
  85. */
  86. protected $article;
  87. /**
  88. * INVERSE SIDE
  89. * @ORM\OneToOne(targetEntity="Shopware\Models\Attribute\ArticleLink", mappedBy="articleLink", cascade={"persist", "update"})
  90. * @var \Shopware\Models\Attribute\ArticleLink
  91. */
  92. protected $attribute;
  93. /**
  94. * Get id
  95. *
  96. * @return integer
  97. */
  98. public function getId()
  99. {
  100. return $this->id;
  101. }
  102. /**
  103. * Set article
  104. *
  105. * @param Article $article
  106. * @return Link
  107. */
  108. public function setArticle($article)
  109. {
  110. $this->article = $article;
  111. return $this;
  112. }
  113. /**
  114. * Get article id
  115. *
  116. * @return Article
  117. */
  118. public function getArticle()
  119. {
  120. return $this->article;
  121. }
  122. /**
  123. * Set name
  124. *
  125. * @param string $name
  126. * @return Link
  127. */
  128. public function setName($name)
  129. {
  130. $this->name = $name;
  131. return $this;
  132. }
  133. /**
  134. * Get name
  135. *
  136. * @return string
  137. */
  138. public function getName()
  139. {
  140. return $this->name;
  141. }
  142. /**
  143. * Set link
  144. *
  145. * @param string $link
  146. * @return Link
  147. */
  148. public function setLink($link)
  149. {
  150. $this->link = $link;
  151. return $this;
  152. }
  153. /**
  154. * Get link
  155. *
  156. * @return string
  157. */
  158. public function getLink()
  159. {
  160. return $this->link;
  161. }
  162. /**
  163. * Set target
  164. *
  165. * @param string $target
  166. * @return Link
  167. */
  168. public function setTarget($target)
  169. {
  170. $this->target = $target;
  171. return $this;
  172. }
  173. /**
  174. * Get target
  175. *
  176. * @return string
  177. */
  178. public function getTarget()
  179. {
  180. return $this->target;
  181. }
  182. /**
  183. * @return \Shopware\Models\Attribute\ArticleLink
  184. */
  185. public function getAttribute()
  186. {
  187. return $this->attribute;
  188. }
  189. /**
  190. * @param \Shopware\Models\Attribute\ArticleLink|array|null $attribute
  191. * @return \Shopware\Models\Attribute\ArticleLink
  192. */
  193. public function setAttribute($attribute)
  194. {
  195. return $this->setOneToOne($attribute, '\Shopware\Models\Attribute\ArticleLink', 'attribute', 'articleLink');
  196. }
  197. }