AddressMetadataManagement.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Customer\Model\Metadata;
  7. use Magento\Customer\Api\AddressMetadataManagementInterface;
  8. use Magento\Customer\Api\Data\AttributeMetadataInterface;
  9. /**
  10. * Service to manage customer address related custom attributes
  11. */
  12. class AddressMetadataManagement implements AddressMetadataManagementInterface
  13. {
  14. /**
  15. * @var AttributeResolver
  16. */
  17. protected $attributeResolver;
  18. /**
  19. * @param AttributeResolver $attributeResolver
  20. */
  21. public function __construct(
  22. AttributeResolver $attributeResolver
  23. ) {
  24. $this->attributeResolver = $attributeResolver;
  25. }
  26. /**
  27. * {@inheritdoc}
  28. */
  29. public function canBeSearchableInGrid(AttributeMetadataInterface $attribute)
  30. {
  31. return $this->attributeResolver->getModelByAttribute(self::ENTITY_TYPE_ADDRESS, $attribute)
  32. ->canBeSearchableInGrid();
  33. }
  34. /**
  35. * {@inheritdoc}
  36. */
  37. public function canBeFilterableInGrid(AttributeMetadataInterface $attribute)
  38. {
  39. return $this->attributeResolver->getModelByAttribute(self::ENTITY_TYPE_ADDRESS, $attribute)
  40. ->canBeFilterableInGrid();
  41. }
  42. }