-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1779 from magento-honey-badgers/MAGETWO-83859-Met…
…adataService-Attribute-Type-Resolver [honey] MAGETWO-83859: Metadata service and Attribute type resolver
- Loading branch information
Showing
114 changed files
with
3,190 additions
and
888 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
152 changes: 0 additions & 152 deletions
152
app/code/Magento/Eav/Model/EavCustomAttributeTypeLocator.php
This file was deleted.
Oops, something went wrong.
57 changes: 0 additions & 57 deletions
57
app/code/Magento/Eav/Model/EavCustomAttributeTypeLocator/ComplexType.php
This file was deleted.
Oops, something went wrong.
50 changes: 0 additions & 50 deletions
50
app/code/Magento/Eav/Model/EavCustomAttributeTypeLocator/SimpleType.php
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Magento\Eav\Model; | ||
|
||
use Magento\Framework\Reflection\TypeProcessor; | ||
use Magento\Framework\Webapi\CustomAttribute\ServiceTypeListInterface; | ||
use Magento\Framework\Webapi\CustomAttributeTypeLocatorInterface; | ||
|
||
/** | ||
* Class to locate types for Eav custom attributes | ||
*/ | ||
class TypeLocator implements CustomAttributeTypeLocatorInterface | ||
{ | ||
/** | ||
* @var \Magento\Framework\Webapi\CustomAttributeTypeLocatorInterface[] | ||
*/ | ||
private $typeLocators; | ||
|
||
/** | ||
* @var ServiceTypeListInterface | ||
*/ | ||
private $serviceTypeList; | ||
|
||
/** | ||
* Initialize TypeLocator | ||
* | ||
* @param ServiceTypeListInterface $serviceTypeList | ||
* @param \Magento\Framework\Webapi\CustomAttributeTypeLocatorInterface[] $typeLocators | ||
*/ | ||
public function __construct( | ||
ServiceTypeListInterface $serviceTypeList, | ||
array $typeLocators = [] | ||
) { | ||
$this->typeLocators = $typeLocators; | ||
$this->serviceTypeList = $serviceTypeList; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getType($attributeCode, $entityType) | ||
{ | ||
foreach ($this->typeLocators as $typeLocator) { | ||
$type = $typeLocator->getType($attributeCode, $entityType); | ||
if ($type !== TypeProcessor::NORMALIZED_ANY_TYPE) { | ||
return $type; | ||
} | ||
} | ||
|
||
return TypeProcessor::NORMALIZED_ANY_TYPE; | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function getAllServiceDataInterfaces() | ||
{ | ||
return $this->serviceTypeList->getDataTypes(); | ||
} | ||
} |
Oops, something went wrong.