AttributeInterface.php 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  1. <?php
  2. /**
  3. *
  4. * Copyright © Magento, Inc. All rights reserved.
  5. * See COPYING.txt for license details.
  6. */
  7. namespace Magento\Eav\Api\Data;
  8. use Magento\Framework\Api\CustomAttributesDataInterface;
  9. use Magento\Framework\Api\MetadataObjectInterface;
  10. /**
  11. * Interface AttributeInterface
  12. * @api
  13. * @since 100.0.2
  14. */
  15. interface AttributeInterface extends CustomAttributesDataInterface, MetadataObjectInterface
  16. {
  17. const ATTRIBUTE_ID = 'attribute_id';
  18. const IS_UNIQUE = 'is_unique';
  19. const SCOPE = 'scope';
  20. const FRONTEND_CLASS = 'frontend_class';
  21. const ATTRIBUTE_CODE = 'attribute_code';
  22. const FRONTEND_INPUT = 'frontend_input';
  23. const IS_REQUIRED = 'is_required';
  24. const OPTIONS = 'options';
  25. const IS_USER_DEFINED = 'is_user_defined';
  26. const FRONTEND_LABEL = 'frontend_label';
  27. const FRONTEND_LABELS = 'frontend_labels';
  28. const NOTE = 'note';
  29. const BACKEND_TYPE = 'backend_type';
  30. const BACKEND_MODEL = 'backend_model';
  31. const SOURCE_MODEL = 'source_model';
  32. const VALIDATE_RULES = 'validate_rules';
  33. const ENTITY_TYPE_ID = 'entity_type_id';
  34. /**
  35. * Retrieve id of the attribute.
  36. *
  37. * @return int|null
  38. */
  39. public function getAttributeId();
  40. /**
  41. * Set id of the attribute.
  42. *
  43. * @param int $attributeId
  44. * @return $this
  45. */
  46. public function setAttributeId($attributeId);
  47. /**
  48. * Retrieve code of the attribute.
  49. *
  50. * @return string
  51. */
  52. public function getAttributeCode();
  53. /**
  54. * Set code of the attribute.
  55. *
  56. * @param string $attributeCode
  57. * @return $this
  58. */
  59. public function setAttributeCode($attributeCode);
  60. /**
  61. * Frontend HTML for input element.
  62. *
  63. * @return string
  64. */
  65. public function getFrontendInput();
  66. /**
  67. * Set frontend HTML for input element.
  68. *
  69. * @param string $frontendInput
  70. * @return $this
  71. */
  72. public function setFrontendInput($frontendInput);
  73. /**
  74. * Retrieve entity type id
  75. *
  76. * @return string
  77. */
  78. public function getEntityTypeId();
  79. /**
  80. * Set entity type id
  81. *
  82. * @param string $entityTypeId
  83. * @return $this
  84. */
  85. public function setEntityTypeId($entityTypeId);
  86. /**
  87. * Whether attribute is required.
  88. *
  89. * @return bool
  90. * @SuppressWarnings(PHPMD.BooleanGetMethodName)
  91. */
  92. public function getIsRequired();
  93. /**
  94. * Set whether attribute is required.
  95. *
  96. * @param bool $isRequired
  97. * @return $this
  98. */
  99. public function setIsRequired($isRequired);
  100. /**
  101. * Return options of the attribute (key => value pairs for select)
  102. *
  103. * @return \Magento\Eav\Api\Data\AttributeOptionInterface[]|null
  104. */
  105. public function getOptions();
  106. /**
  107. * Set options of the attribute (key => value pairs for select)
  108. *
  109. * @param \Magento\Eav\Api\Data\AttributeOptionInterface[] $options
  110. * @return $this
  111. */
  112. public function setOptions(array $options = null);
  113. /**
  114. * Whether current attribute has been defined by a user.
  115. *
  116. * @return bool|null
  117. */
  118. public function getIsUserDefined();
  119. /**
  120. * Set whether current attribute has been defined by a user.
  121. *
  122. * @param bool $isUserDefined
  123. * @return $this
  124. */
  125. public function setIsUserDefined($isUserDefined);
  126. /**
  127. * Return frontend label for default store
  128. *
  129. * @return string|null
  130. */
  131. public function getDefaultFrontendLabel();
  132. /**
  133. * Set frontend label for default store
  134. *
  135. * @param string $defaultFrontendLabel
  136. * @return $this
  137. */
  138. public function setDefaultFrontendLabel($defaultFrontendLabel);
  139. /**
  140. * Return frontend label for each store
  141. *
  142. * @return \Magento\Eav\Api\Data\AttributeFrontendLabelInterface[]
  143. */
  144. public function getFrontendLabels();
  145. /**
  146. * Set frontend label for each store
  147. *
  148. * @param \Magento\Eav\Api\Data\AttributeFrontendLabelInterface[] $frontendLabels
  149. * @return $this
  150. */
  151. public function setFrontendLabels(array $frontendLabels = null);
  152. /**
  153. * Get the note attribute for the element.
  154. *
  155. * @return string|null
  156. */
  157. public function getNote();
  158. /**
  159. * Set the note attribute for the element.
  160. *
  161. * @param string $note
  162. * @return $this
  163. */
  164. public function setNote($note);
  165. /**
  166. * Get backend type.
  167. *
  168. * @return string|null
  169. */
  170. public function getBackendType();
  171. /**
  172. * Set backend type.
  173. *
  174. * @param string $backendType
  175. * @return $this
  176. */
  177. public function setBackendType($backendType);
  178. /**
  179. * Get backend model
  180. *
  181. * @return string|null
  182. */
  183. public function getBackendModel();
  184. /**
  185. * Set backend model
  186. *
  187. * @param string $backendModel
  188. * @return $this
  189. */
  190. public function setBackendModel($backendModel);
  191. /**
  192. * Get source model
  193. *
  194. * @return string|null
  195. */
  196. public function getSourceModel();
  197. /**
  198. * Set source model
  199. *
  200. * @param string $sourceModel
  201. * @return $this
  202. */
  203. public function setSourceModel($sourceModel);
  204. /**
  205. * Get default value for the element.
  206. *
  207. * @return string|null
  208. */
  209. public function getDefaultValue();
  210. /**
  211. * Set default value for the element.
  212. *
  213. * @param string $defaultValue
  214. * @return $this
  215. */
  216. public function setDefaultValue($defaultValue);
  217. /**
  218. * Whether this is a unique attribute
  219. *
  220. * @return string|null
  221. */
  222. public function getIsUnique();
  223. /**
  224. * Set whether this is a unique attribute
  225. *
  226. * @param string $isUnique
  227. * @return $this
  228. */
  229. public function setIsUnique($isUnique);
  230. /**
  231. * Retrieve frontend class of attribute
  232. *
  233. * @return string|null
  234. */
  235. public function getFrontendClass();
  236. /**
  237. * Set frontend class of attribute
  238. *
  239. * @param string $frontendClass
  240. * @return $this
  241. */
  242. public function setFrontendClass($frontendClass);
  243. /**
  244. * Retrieve validation rules.
  245. *
  246. * @return \Magento\Eav\Api\Data\AttributeValidationRuleInterface[]|null
  247. */
  248. public function getValidationRules();
  249. /**
  250. * Set validation rules.
  251. *
  252. * @param \Magento\Eav\Api\Data\AttributeValidationRuleInterface[] $validationRules
  253. * @return $this
  254. */
  255. public function setValidationRules(array $validationRules = null);
  256. /**
  257. * @return \Magento\Eav\Api\Data\AttributeExtensionInterface|null
  258. */
  259. public function getExtensionAttributes();
  260. /**
  261. * Set an extension attributes object
  262. *
  263. * @param \Magento\Eav\Api\Data\AttributeExtensionInterface $extensionAttributes
  264. * @return $this
  265. * @since 102.0.0
  266. */
  267. public function setExtensionAttributes(
  268. \Magento\Eav\Api\Data\AttributeExtensionInterface $extensionAttributes
  269. );
  270. }