1212use Magento \Framework \Filesystem ;
1313use Magento \Framework \Filesystem \Directory \ReadInterface ;
1414use Magento \Framework \Filesystem \Driver \File ;
15- use Magento \Framework \Stdlib \DateTime \DateTime ;
15+ use Magento \Framework \Stdlib \DateTime \DateTimeFactory ;
1616use Magento \MediaGalleryApi \Api \GetAssetsByPathsInterface ;
1717use Magento \MediaGallerySynchronizationApi \Model \ImportFilesInterface ;
1818use Magento \MediaGallerySynchronizationApi \Api \SynchronizeFilesInterface ;
@@ -60,14 +60,14 @@ class SynchronizeFiles implements SynchronizeFilesInterface
6060 private $ importFiles ;
6161
6262 /**
63- * @var DateTime
63+ * @var DateTimeFactory
6464 */
65- private $ date ;
65+ private $ dateFactory ;
6666
6767 /**
6868 * @param File $driver
6969 * @param Filesystem $filesystem
70- * @param DateTime $date
70+ * @param DateTimeFactory $dateFactory
7171 * @param LoggerInterface $log
7272 * @param GetFileInfo $getFileInfo
7373 * @param GetAssetsByPathsInterface $getAssetsByPaths
@@ -76,15 +76,15 @@ class SynchronizeFiles implements SynchronizeFilesInterface
7676 public function __construct (
7777 File $ driver ,
7878 Filesystem $ filesystem ,
79- DateTime $ date ,
79+ DateTimeFactory $ dateFactory ,
8080 LoggerInterface $ log ,
8181 GetFileInfo $ getFileInfo ,
8282 GetAssetsByPathsInterface $ getAssetsByPaths ,
8383 ImportFilesInterface $ importFiles
8484 ) {
8585 $ this ->driver = $ driver ;
8686 $ this ->filesystem = $ filesystem ;
87- $ this ->date = $ date ;
87+ $ this ->dateFactory = $ dateFactory ;
8888 $ this ->log = $ log ;
8989 $ this ->getFileInfo = $ getFileInfo ;
9090 $ this ->getAssetsByPaths = $ getAssetsByPaths ;
@@ -148,7 +148,7 @@ private function getPathsToUpdate(array $paths): array
148148 */
149149 private function getFileModificationTime (string $ path ): string
150150 {
151- return $ this ->date ->gmtDate (
151+ return $ this ->dateFactory -> create () ->gmtDate (
152152 self ::DATE_FORMAT ,
153153 $ this ->getFileInfo ->execute ($ this ->getMediaDirectory ()->getAbsolutePath ($ path ))->getMTime ()
154154 );
0 commit comments