@@ -760,6 +760,7 @@ public function __construct(
760
760
$ this ->_linkFactory = $ linkFactory ;
761
761
$ this ->_proxyProdFactory = $ proxyProdFactory ;
762
762
$ this ->_uploaderFactory = $ uploaderFactory ;
763
+ $ this ->filesystem = $ filesystem ;
763
764
$ this ->_mediaDirectory = $ filesystem ->getDirectoryWrite (DirectoryList::ROOT );
764
765
$ this ->_stockResItemFac = $ stockResItemFac ;
765
766
$ this ->_localeDate = $ localeDate ;
@@ -1999,27 +2000,12 @@ protected function uploadMediaFiles($fileName, $renameFileOff = false)
1999
2000
private function getSystemFile ($ fileName )
2000
2001
{
2001
2002
$ filePath = 'catalog ' . DIRECTORY_SEPARATOR . 'product ' . DIRECTORY_SEPARATOR . $ fileName ;
2002
- /** @var Filesystem $filesystem */
2003
- $ filesystem = $ this ->getFilesystem ();
2004
2003
/** @var \Magento\Framework\Filesystem\Directory\ReadInterface $read */
2005
- $ read = $ filesystem ->getDirectoryRead (DirectoryList::MEDIA );
2004
+ $ read = $ this -> filesystem ->getDirectoryRead (DirectoryList::MEDIA );
2006
2005
2007
2006
return $ read ->isExist ($ filePath ) && $ read ->isReadable ($ filePath ) ? $ fileName : '' ;
2008
2007
}
2009
2008
2010
- /**
2011
- * Getter for singleton-like Filesystem object.
2012
- *
2013
- * @return Filesystem
2014
- */
2015
- private function getFilesystem ()
2016
- {
2017
- if (!$ this ->filesystem ) {
2018
- $ this ->filesystem = ObjectManager::getInstance ()->get (Filesystem::class);
2019
- }
2020
- return $ this ->filesystem ;
2021
- }
2022
-
2023
2009
/**
2024
2010
* Save product media gallery.
2025
2011
*
0 commit comments