CustomAttributesDataInterface.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Framework\Api;
  7. /**
  8. * Interface for entities which can be extended with custom attributes.
  9. *
  10. * @api
  11. * @since 100.0.2
  12. */
  13. interface CustomAttributesDataInterface extends ExtensibleDataInterface
  14. {
  15. /**
  16. * Array key for custom attributes
  17. */
  18. const CUSTOM_ATTRIBUTES = 'custom_attributes';
  19. /**
  20. * Get an attribute value.
  21. *
  22. * @param string $attributeCode
  23. * @return \Magento\Framework\Api\AttributeInterface|null
  24. */
  25. public function getCustomAttribute($attributeCode);
  26. /**
  27. * Set an attribute value for a given attribute code
  28. *
  29. * @param string $attributeCode
  30. * @param mixed $attributeValue
  31. * @return $this
  32. */
  33. public function setCustomAttribute($attributeCode, $attributeValue);
  34. /**
  35. * Retrieve custom attributes values.
  36. *
  37. * @return \Magento\Framework\Api\AttributeInterface[]|null
  38. */
  39. public function getCustomAttributes();
  40. /**
  41. * Set array of custom attributes
  42. *
  43. * @param \Magento\Framework\Api\AttributeInterface[] $attributes
  44. * @return $this
  45. * @throws \LogicException
  46. */
  47. public function setCustomAttributes(array $attributes);
  48. }