@@ -498,21 +498,26 @@ protected function _getResource()
498
498
}
499
499
500
500
/**
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 for product will return all product attribute codes
503
504
*
504
505
* @return string[]
505
506
*/
506
507
protected function getCustomAttributesCodes ()
507
508
{
508
509
if ($ this ->customAttributesCodes === null ) {
509
- $ this ->customAttributesCodes = array_keys ($ this ->eavConfig ->getEntityAttributes (
510
- self ::ENTITY ,
511
- $ this
512
- ));
513
-
514
- $ this ->customAttributesCodes = $ this ->filterCustomAttribute ->execute ($ this ->customAttributesCodes );
515
- $ this ->customAttributesCodes = array_diff ($ this ->customAttributesCodes , ProductInterface::ATTRIBUTES );
510
+ $ this ->customAttributesCodes = array_diff (
511
+ array_keys (
512
+ $ this ->filterCustomAttribute ->execute (
513
+ $ this ->eavConfig ->getEntityAttributes (
514
+ self ::ENTITY ,
515
+ $ this
516
+ )
517
+ )
518
+ ),
519
+ ProductInterface::ATTRIBUTES
520
+ );
516
521
}
517
522
518
523
return $ this ->customAttributesCodes ;
@@ -584,8 +589,9 @@ public function getPrice()
584
589
}
585
590
586
591
/**
587
- * @codeCoverageIgnoreStart
588
592
* Get visibility status
593
+ *
594
+ * @codeCoverageIgnoreStart
589
595
* @see \Magento\Catalog\Model\Product\Visibility
590
596
*
591
597
* @return int
@@ -662,6 +668,7 @@ public function getStatus()
662
668
663
669
/**
664
670
* Retrieve type instance of the product.
671
+ *
665
672
* Type instance implements product type depended logic and is a singleton shared by all products of the same type.
666
673
*
667
674
* @return \Magento\Catalog\Model\Product\Type\AbstractType
@@ -822,9 +829,10 @@ public function getStoreIds()
822
829
823
830
/**
824
831
* Retrieve product attributes
825
- * if $groupId is null - retrieve all product attributes
826
832
*
827
- * @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
828
836
* @param bool $skipSuper Not used
829
837
* @return \Magento\Eav\Model\Entity\Attribute\AbstractAttribute[]
830
838
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
@@ -916,6 +924,7 @@ public function beforeSave()
916
924
917
925
/**
918
926
* Check/set if options can be affected when saving product
927
+ *
919
928
* If value specified, it will be set.
920
929
*
921
930
* @param bool $value
@@ -1036,9 +1045,11 @@ public function reindex()
1036
1045
1037
1046
/**
1038
1047
* Clear cache related with product and protect delete from not admin
1048
+ *
1039
1049
* Register indexing event before delete product
1040
1050
*
1041
1051
* @return \Magento\Catalog\Model\Product
1052
+ * @throws \Magento\Framework\Exception\LocalizedException
1042
1053
*/
1043
1054
public function beforeDelete ()
1044
1055
{
@@ -1545,12 +1556,12 @@ public function hasGalleryAttribute()
1545
1556
/**
1546
1557
* Add image to media gallery
1547
1558
*
1548
- * @param string $file file path of image in file system
1549
- * @param string|array $mediaAttribute code of attribute with type 'media_image',
1550
- * leave blank if image should be only in gallery
1551
- * @param boolean $move if true, it will move source file
1552
- * @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
1553
1563
* @return \Magento\Catalog\Model\Product
1564
+ * @throws \Magento\Framework\Exception\LocalizedException
1554
1565
*/
1555
1566
public function addImageToMediaGallery ($ file , $ mediaAttribute = null , $ move = false , $ exclude = true )
1556
1567
{
@@ -1711,7 +1722,6 @@ public function getIsSalable()
1711
1722
1712
1723
/**
1713
1724
* Check is a virtual product
1714
- * Data helper wrapper
1715
1725
*
1716
1726
* @return bool
1717
1727
*/
@@ -1804,8 +1814,8 @@ public function formatUrlKey($str)
1804
1814
* Save current attribute with code $code and assign new value
1805
1815
*
1806
1816
* @param string $code Attribute code
1807
- * @param mixed $value New attribute value
1808
- * @param int $store Store ID
1817
+ * @param mixed $value New attribute value
1818
+ * @param int $store Store ID
1809
1819
* @return void
1810
1820
*/
1811
1821
public function addAttributeUpdate ($ code , $ value , $ store )
@@ -1875,6 +1885,7 @@ public function getRequestPath()
1875
1885
1876
1886
/**
1877
1887
* Custom function for other modules
1888
+ *
1878
1889
* @return string
1879
1890
*/
1880
1891
public function getGiftMessageAvailable ()
@@ -1993,6 +2004,8 @@ public function getOptions()
1993
2004
}
1994
2005
1995
2006
/**
2007
+ * Set options for product
2008
+ *
1996
2009
* @param \Magento\Catalog\Api\Data\ProductCustomOptionInterface[] $options
1997
2010
* @return $this
1998
2011
*/
@@ -2016,10 +2029,10 @@ public function getIsVirtual()
2016
2029
/**
2017
2030
* Add custom option information to product
2018
2031
*
2019
- * @param string $code Option code
2020
- * @param mixed $value Value of the option
2021
- * @param int|Product $product Product ID
2022
- * @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
2023
2036
*/
2024
2037
public function addCustomOption ($ code , $ value , $ product = null )
2025
2038
{
@@ -2213,6 +2226,7 @@ public function getPreconfiguredValues()
2213
2226
2214
2227
/**
2215
2228
* Prepare product custom options.
2229
+ *
2216
2230
* To be sure that all product custom options does not has ID and has product instance
2217
2231
*
2218
2232
* @return \Magento\Catalog\Model\Product
@@ -2547,17 +2561,17 @@ public function setTypeId($typeId)
2547
2561
}
2548
2562
2549
2563
/**
2550
- * {@inheritdoc}
2564
+ * Retrieve existing extension attributes object or create a new one.
2551
2565
*
2552
- * @return \Magento\Catalog \Api\Data\ProductExtensionInterface
2566
+ * @return \Magento\Framework \Api\ExtensionAttributesInterface
2553
2567
*/
2554
2568
public function getExtensionAttributes ()
2555
2569
{
2556
2570
return $ this ->_getExtensionAttributes ();
2557
2571
}
2558
2572
2559
2573
/**
2560
- * {@inheritdoc}
2574
+ * Set an extension attributes object.
2561
2575
*
2562
2576
* @param \Magento\Catalog\Api\Data\ProductExtensionInterface $extensionAttributes
2563
2577
* @return $this
@@ -2570,8 +2584,11 @@ public function setExtensionAttributes(\Magento\Catalog\Api\Data\ProductExtensio
2570
2584
//@codeCoverageIgnoreEnd
2571
2585
2572
2586
/**
2587
+ * Convert to media gallery interface
2588
+ *
2573
2589
* @param array $mediaGallery
2574
2590
* @return \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface[]
2591
+ * @throws \Magento\Framework\Exception\LocalizedException
2575
2592
*/
2576
2593
protected function convertToMediaGalleryInterface (array $ mediaGallery )
2577
2594
{
@@ -2587,7 +2604,10 @@ protected function convertToMediaGalleryInterface(array $mediaGallery)
2587
2604
}
2588
2605
2589
2606
/**
2607
+ * Get media gallery entries
2608
+ *
2590
2609
* @return \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface[]|null
2610
+ * @throws \Magento\Framework\Exception\LocalizedException
2591
2611
*/
2592
2612
public function getMediaGalleryEntries ()
2593
2613
{
@@ -2601,8 +2621,11 @@ public function getMediaGalleryEntries()
2601
2621
}
2602
2622
2603
2623
/**
2624
+ * Set media gallery entries
2625
+ *
2604
2626
* @param ProductAttributeMediaGalleryEntryInterface[] $mediaGalleryEntries
2605
2627
* @return $this
2628
+ * @throws \Magento\Framework\Exception\LocalizedException
2606
2629
*/
2607
2630
public function setMediaGalleryEntries (array $ mediaGalleryEntries = null )
2608
2631
{
@@ -2643,6 +2666,8 @@ public function setId($value)
2643
2666
}
2644
2667
2645
2668
/**
2669
+ * Get link repository
2670
+ *
2646
2671
* @return ProductLinkRepositoryInterface
2647
2672
*/
2648
2673
private function getLinkRepository ()
@@ -2655,6 +2680,8 @@ private function getLinkRepository()
2655
2680
}
2656
2681
2657
2682
/**
2683
+ * Get media gallery processor
2684
+ *
2658
2685
* @return Product\Gallery\Processor
2659
2686
*/
2660
2687
private function getMediaGalleryProcessor ()
0 commit comments