99use Magento \CatalogImportExport \Model \Import \Product \RowValidatorInterface as ValidatorInterface ;
1010use Magento \Framework \App \Filesystem \DirectoryList ;
1111use Magento \Framework \App \ObjectManager ;
12+ use Magento \Framework \Exception \LocalizedException ;
1213use Magento \Framework \Model \ResourceModel \Db \ObjectRelationProcessor ;
1314use Magento \Framework \Model \ResourceModel \Db \TransactionManagerInterface ;
1415use Magento \Framework \Stdlib \DateTime ;
@@ -714,7 +715,7 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity
714715 * @param \Magento\CatalogInventory\Model\Spi\StockStateProviderInterface $stockStateProvider
715716 * @param \Magento\Catalog\Helper\Data $catalogData
716717 * @param \Magento\ImportExport\Model\Import\Config $importConfig
717- * @param Proxy\Product\ResourceFactory $resourceFactory
718+ * @param Proxy\Product\ResourceModelFactory $resourceFactory
718719 * @param Product\OptionFactory $optionFactory
719720 * @param \Magento\Eav\Model\ResourceModel\Entity\Attribute\Set\CollectionFactory $setColFactory
720721 * @param Product\Type\Factory $productTypeFactory
@@ -1089,12 +1090,12 @@ protected function _initTypeModels()
10891090 $ params = [$ this , $ productTypeName ];
10901091 if (!($ model = $ this ->_productTypeFactory ->create ($ productTypeConfig ['model ' ], ['params ' => $ params ]))
10911092 ) {
1092- throw new \ Magento \ Framework \ Exception \ LocalizedException (
1093+ throw new LocalizedException (
10931094 __ ('Entity type model \'%1 \' is not found ' , $ productTypeConfig ['model ' ])
10941095 );
10951096 }
10961097 if (!$ model instanceof \Magento \CatalogImportExport \Model \Import \Product \Type \AbstractType) {
1097- throw new \ Magento \ Framework \ Exception \ LocalizedException (
1098+ throw new LocalizedException (
10981099 __ (
10991100 'Entity type model must be an instance of '
11001101 . \Magento \CatalogImportExport \Model \Import \Product \Type \AbstractType::class
@@ -1561,6 +1562,7 @@ public function getImagesFromRow(array $rowData)
15611562 * @SuppressWarnings(PHPMD.NPathComplexity)
15621563 * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
15631564 * @SuppressWarnings(PHPMD.UnusedLocalVariable)
1565+ * @throws LocalizedException
15641566 */
15651567 protected function _saveProducts ()
15661568 {
@@ -1621,7 +1623,7 @@ protected function _saveProducts()
16211623
16221624 // wrong attribute_set_code was received
16231625 if (!$ attributeSetId ) {
1624- throw new \ Magento \ Framework \ Exception \ LocalizedException (
1626+ throw new LocalizedException (
16251627 __ (
16261628 'Wrong attribute set code "%1", please correct it and try again. ' ,
16271629 $ rowData ['attribute_set_code ' ]
@@ -1826,7 +1828,7 @@ protected function _saveProducts()
18261828 ) {
18271829 $ attrValue = $ this ->dateTime ->formatDate ($ attrValue , false );
18281830 } elseif ('datetime ' == $ attribute ->getBackendType () && strtotime ($ attrValue )) {
1829- $ attrValue = $ this -> dateTime -> gmDate (
1831+ $ attrValue = gmdate (
18301832 'Y-m-d H:i:s ' ,
18311833 $ this ->_localeDate ->date ($ attrValue )->getTimestamp ()
18321834 );
@@ -2008,7 +2010,7 @@ protected function _getUploader()
20082010 }
20092011
20102012 if (!$ this ->_fileUploader ->setTmpDir ($ tmpPath )) {
2011- throw new \ Magento \ Framework \ Exception \ LocalizedException (
2013+ throw new LocalizedException (
20122014 __ ('File directory \'%1 \' is not readable. ' , $ tmpPath )
20132015 );
20142016 }
@@ -2017,7 +2019,7 @@ protected function _getUploader()
20172019
20182020 $ this ->_mediaDirectory ->create ($ destinationPath );
20192021 if (!$ this ->_fileUploader ->setDestDir ($ destinationPath )) {
2020- throw new \ Magento \ Framework \ Exception \ LocalizedException (
2022+ throw new LocalizedException (
20212023 __ ('File directory \'%1 \' is not writable. ' , $ destinationPath )
20222024 );
20232025 }
@@ -2039,6 +2041,8 @@ public function getUploader()
20392041 * Return a new file name if the same file is already exists.
20402042 *
20412043 * @param string $fileName
2044+ * @param bool $renameFileOff [optional] boolean to pass.
2045+ * Default is false which will set not to rename the file after import.
20422046 * @return string
20432047 */
20442048 protected function uploadMediaFiles ($ fileName , $ renameFileOff = false )
@@ -2247,7 +2251,7 @@ protected function _saveStockItem()
22472251 $ stockItemDo ->setData ($ row );
22482252 $ row ['is_in_stock ' ] = $ this ->stockStateProvider ->verifyStock ($ stockItemDo );
22492253 if ($ this ->stockStateProvider ->verifyNotification ($ stockItemDo )) {
2250- $ row ['low_stock_date ' ] = $ this -> dateTime -> gmDate (
2254+ $ row ['low_stock_date ' ] = gmdate (
22512255 'Y-m-d H:i:s ' ,
22522256 (new \DateTime ())->getTimestamp ()
22532257 );
@@ -2763,7 +2767,7 @@ private function _customFieldsMapping($rowData)
27632767 /**
27642768 * Validate data rows and save bunches to DB
27652769 *
2766- * @return $this
2770+ * @return $this|AbstractEntity
27672771 */
27682772 protected function _saveValidatedBunches ()
27692773 {
0 commit comments