Skip to content

Commit df29676

Browse files
committed
MAGETWO-95652: Call to \Magento\Framework\Api\MetadataServiceInterface::getCustomAttributesMetadata leads to fatal error
1 parent 2cb6a02 commit df29676

File tree

1 file changed

+45
-21
lines changed

1 file changed

+45
-21
lines changed

app/code/Magento/Catalog/Model/Product.php

Lines changed: 45 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -498,8 +498,9 @@ protected function _getResource()
498498
}
499499

500500
/**
501-
* Get a list of custom attribute codes that belongs to product attribute set. If attribute set not specified for
502-
* product will return all product attribute codes
501+
* Get a list of custom attribute codes that belongs to product attribute set.
502+
*
503+
* If attribute set not specified fors product will return all product attribute codes
503504
*
504505
* @return string[]
505506
*/
@@ -514,7 +515,8 @@ protected function getCustomAttributesCodes()
514515
$this
515516
)
516517
)
517-
), ProductInterface::ATTRIBUTES
518+
),
519+
ProductInterface::ATTRIBUTES
518520
);
519521
}
520522

@@ -587,8 +589,9 @@ public function getPrice()
587589
}
588590

589591
/**
590-
* @codeCoverageIgnoreStart
591592
* Get visibility status
593+
*
594+
* @codeCoverageIgnoreStart
592595
* @see \Magento\Catalog\Model\Product\Visibility
593596
*
594597
* @return int
@@ -665,6 +668,7 @@ public function getStatus()
665668

666669
/**
667670
* Retrieve type instance of the product.
671+
*
668672
* Type instance implements product type depended logic and is a singleton shared by all products of the same type.
669673
*
670674
* @return \Magento\Catalog\Model\Product\Type\AbstractType
@@ -825,9 +829,10 @@ public function getStoreIds()
825829

826830
/**
827831
* Retrieve product attributes
828-
* if $groupId is null - retrieve all product attributes
829832
*
830-
* @param int $groupId Retrieve attributes of the specified group
833+
* If $groupId is null - retrieve all product attributes
834+
*
835+
* @param int $groupId Retrieve attributes of the specified group
831836
* @param bool $skipSuper Not used
832837
* @return \Magento\Eav\Model\Entity\Attribute\AbstractAttribute[]
833838
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
@@ -919,6 +924,7 @@ public function beforeSave()
919924

920925
/**
921926
* Check/set if options can be affected when saving product
927+
*
922928
* If value specified, it will be set.
923929
*
924930
* @param bool $value
@@ -1039,9 +1045,11 @@ public function reindex()
10391045

10401046
/**
10411047
* Clear cache related with product and protect delete from not admin
1048+
*
10421049
* Register indexing event before delete product
10431050
*
10441051
* @return \Magento\Catalog\Model\Product
1052+
* @throws \Magento\Framework\Exception\LocalizedException
10451053
*/
10461054
public function beforeDelete()
10471055
{
@@ -1548,12 +1556,12 @@ public function hasGalleryAttribute()
15481556
/**
15491557
* Add image to media gallery
15501558
*
1551-
* @param string $file file path of image in file system
1552-
* @param string|array $mediaAttribute code of attribute with type 'media_image',
1553-
* leave blank if image should be only in gallery
1554-
* @param boolean $move if true, it will move source file
1555-
* @param boolean $exclude mark image as disabled in product page view
1559+
* @param string $file file path of image in file system
1560+
* @param string|array $mediaAttribute code of type 'media_image', leave blank if image should be only in gallery
1561+
* @param boolean $move if true, it will move source file
1562+
* @param boolean $exclude mark image as disabled in product page view
15561563
* @return \Magento\Catalog\Model\Product
1564+
* @throws \Magento\Framework\Exception\LocalizedException
15571565
*/
15581566
public function addImageToMediaGallery($file, $mediaAttribute = null, $move = false, $exclude = true)
15591567
{
@@ -1714,7 +1722,6 @@ public function getIsSalable()
17141722

17151723
/**
17161724
* Check is a virtual product
1717-
* Data helper wrapper
17181725
*
17191726
* @return bool
17201727
*/
@@ -1807,8 +1814,8 @@ public function formatUrlKey($str)
18071814
* Save current attribute with code $code and assign new value
18081815
*
18091816
* @param string $code Attribute code
1810-
* @param mixed $value New attribute value
1811-
* @param int $store Store ID
1817+
* @param mixed $value New attribute value
1818+
* @param int $store Store ID
18121819
* @return void
18131820
*/
18141821
public function addAttributeUpdate($code, $value, $store)
@@ -1878,6 +1885,7 @@ public function getRequestPath()
18781885

18791886
/**
18801887
* Custom function for other modules
1888+
*
18811889
* @return string
18821890
*/
18831891
public function getGiftMessageAvailable()
@@ -1996,6 +2004,8 @@ public function getOptions()
19962004
}
19972005

19982006
/**
2007+
* Set options for product
2008+
*
19992009
* @param \Magento\Catalog\Api\Data\ProductCustomOptionInterface[] $options
20002010
* @return $this
20012011
*/
@@ -2019,10 +2029,10 @@ public function getIsVirtual()
20192029
/**
20202030
* Add custom option information to product
20212031
*
2022-
* @param string $code Option code
2023-
* @param mixed $value Value of the option
2024-
* @param int|Product $product Product ID
2025-
* @return $this
2032+
* @param string $code Option code
2033+
* @param mixed $value Value of the option
2034+
* @param int|Product $product Product ID
2035+
* @return $this
20262036
*/
20272037
public function addCustomOption($code, $value, $product = null)
20282038
{
@@ -2216,6 +2226,7 @@ public function getPreconfiguredValues()
22162226

22172227
/**
22182228
* Prepare product custom options.
2229+
*
22192230
* To be sure that all product custom options does not has ID and has product instance
22202231
*
22212232
* @return \Magento\Catalog\Model\Product
@@ -2550,17 +2561,17 @@ public function setTypeId($typeId)
25502561
}
25512562

25522563
/**
2553-
* {@inheritdoc}
2564+
* Retrieve existing extension attributes object or create a new one.
25542565
*
2555-
* @return \Magento\Catalog\Api\Data\ProductExtensionInterface
2566+
* @return \Magento\Framework\Api\ExtensionAttributesInterface
25562567
*/
25572568
public function getExtensionAttributes()
25582569
{
25592570
return $this->_getExtensionAttributes();
25602571
}
25612572

25622573
/**
2563-
* {@inheritdoc}
2574+
* Set an extension attributes object.
25642575
*
25652576
* @param \Magento\Catalog\Api\Data\ProductExtensionInterface $extensionAttributes
25662577
* @return $this
@@ -2573,8 +2584,11 @@ public function setExtensionAttributes(\Magento\Catalog\Api\Data\ProductExtensio
25732584
//@codeCoverageIgnoreEnd
25742585

25752586
/**
2587+
* Convert to media gallery interface
2588+
*
25762589
* @param array $mediaGallery
25772590
* @return \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface[]
2591+
* @throws \Magento\Framework\Exception\LocalizedException
25782592
*/
25792593
protected function convertToMediaGalleryInterface(array $mediaGallery)
25802594
{
@@ -2590,7 +2604,10 @@ protected function convertToMediaGalleryInterface(array $mediaGallery)
25902604
}
25912605

25922606
/**
2607+
* Get media gallery entries
2608+
*
25932609
* @return \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface[]|null
2610+
* @throws \Magento\Framework\Exception\LocalizedException
25942611
*/
25952612
public function getMediaGalleryEntries()
25962613
{
@@ -2604,8 +2621,11 @@ public function getMediaGalleryEntries()
26042621
}
26052622

26062623
/**
2624+
* Set media gallery entries
2625+
*
26072626
* @param ProductAttributeMediaGalleryEntryInterface[] $mediaGalleryEntries
26082627
* @return $this
2628+
* @throws \Magento\Framework\Exception\LocalizedException
26092629
*/
26102630
public function setMediaGalleryEntries(array $mediaGalleryEntries = null)
26112631
{
@@ -2646,6 +2666,8 @@ public function setId($value)
26462666
}
26472667

26482668
/**
2669+
* Get link repository
2670+
*
26492671
* @return ProductLinkRepositoryInterface
26502672
*/
26512673
private function getLinkRepository()
@@ -2658,6 +2680,8 @@ private function getLinkRepository()
26582680
}
26592681

26602682
/**
2683+
* Get media gallery processor
2684+
*
26612685
* @return Product\Gallery\Processor
26622686
*/
26632687
private function getMediaGalleryProcessor()

0 commit comments

Comments
 (0)