File tree Expand file tree Collapse file tree 7 files changed +41
-17
lines changed
MediaGallerySynchronizationApi
MediaGallerySynchronizationMetadata
MediaGallerySynchronization Expand file tree Collapse file tree 7 files changed +41
-17
lines changed Original file line number Diff line number Diff line change 5
5
*/
6
6
declare (strict_types=1 );
7
7
8
- namespace Magento \MediaGallerySynchronizationApi \Model ;
8
+ namespace Magento \MediaGallerySynchronization \Model ;
9
9
10
10
use Magento \Framework \App \Filesystem \DirectoryList ;
11
11
use Magento \Framework \Exception \FileSystemException ;
15
15
use Magento \MediaGalleryApi \Api \Data \AssetInterface ;
16
16
use Magento \MediaGalleryApi \Api \Data \AssetInterfaceFactory ;
17
17
use Magento \MediaGallerySynchronization \Model \Filesystem \GetFileInfo ;
18
- use Magento \MediaGallerySynchronization \Model \GetContentHash ;
18
+ use Magento \MediaGallerySynchronizationApi \Model \CreateAssetFromFileInterface ;
19
19
20
20
/**
21
21
* Create media asset object based on the file information
22
22
*/
23
- class CreateAssetFromFile
23
+ class CreateAssetFromFile implements CreateAssetFromFileInterface
24
24
{
25
25
/**
26
26
* @var Filesystem
@@ -69,11 +69,7 @@ public function __construct(
69
69
}
70
70
71
71
/**
72
- * Create and format media asset object
73
- *
74
- * @param string $path
75
- * @return AssetInterface
76
- * @throws FileSystemException
72
+ * @inheridoc
77
73
*/
78
74
public function execute (string $ path ): AssetInterface
79
75
{
Original file line number Diff line number Diff line change 12
12
use Magento \MediaGalleryApi \Api \Data \AssetInterface ;
13
13
use Magento \MediaGalleryApi \Api \Data \AssetInterfaceFactory ;
14
14
use Magento \MediaGalleryApi \Api \GetAssetsByPathsInterface ;
15
- use Magento \MediaGallerySynchronizationApi \Model \CreateAssetFromFile ;
15
+ use Magento \MediaGallerySynchronizationApi \Model \CreateAssetFromFileInterface ;
16
16
17
17
/**
18
18
* Create media asset object based on the file information
@@ -30,19 +30,19 @@ class GetAssetFromPath
30
30
private $ assetFactory ;
31
31
32
32
/**
33
- * @var CreateAssetFromFile
33
+ * @var CreateAssetFromFileInterface
34
34
*/
35
35
private $ createAssetFromFile ;
36
36
37
37
/**
38
38
* @param AssetInterfaceFactory $assetFactory
39
39
* @param GetAssetsByPathsInterface $getMediaGalleryAssetByPath
40
- * @param CreateAssetFromFile $createAssetFromFile
40
+ * @param CreateAssetFromFileInterface $createAssetFromFile
41
41
*/
42
42
public function __construct (
43
43
AssetInterfaceFactory $ assetFactory ,
44
44
GetAssetsByPathsInterface $ getMediaGalleryAssetByPath ,
45
- CreateAssetFromFile $ createAssetFromFile
45
+ CreateAssetFromFileInterface $ createAssetFromFile
46
46
) {
47
47
$ this ->assetFactory = $ assetFactory ;
48
48
$ this ->getAssetsByPaths = $ getMediaGalleryAssetByPath ;
Original file line number Diff line number Diff line change 9
9
<preference for =" Magento\MediaGallerySynchronizationApi\Api\SynchronizeInterface" type =" Magento\MediaGallerySynchronization\Model\Synchronize" />
10
10
<preference for =" Magento\MediaGallerySynchronizationApi\Model\FetchBatchesInterface" type =" Magento\MediaGallerySynchronization\Model\FetchBatches" />
11
11
<preference for =" Magento\MediaGallerySynchronizationApi\Api\SynchronizeFilesInterface" type =" Magento\MediaGallerySynchronization\Model\SynchronizeFiles" />
12
+ <preference for =" Magento\MediaGallerySynchronizationApi\Model\CreateAssetFromFileInterface" type =" Magento\MediaGallerySynchronization\Model\CreateAssetFromFile" />
12
13
<type name =" Magento\MediaGallerySynchronizationApi\Model\ImportFilesComposite" >
13
14
<arguments >
14
15
<argument name =" importers" xsi : type =" array" >
Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Copyright © Magento, Inc. All rights reserved.
4
+ * See COPYING.txt for license details.
5
+ */
6
+ declare (strict_types=1 );
7
+
8
+ namespace Magento \MediaGallerySynchronizationApi \Model ;
9
+
10
+ use Magento \Framework \Exception \FileSystemException ;
11
+ use Magento \MediaGalleryApi \Api \Data \AssetInterface ;
12
+
13
+ /**
14
+ * Create media asset object from the media file
15
+ */
16
+ interface CreateAssetFromFileInterface
17
+ {
18
+ /**
19
+ * Create media asset object from the media file
20
+ *
21
+ * @param string $path
22
+ * @return AssetInterface
23
+ * @throws FileSystemException
24
+ */
25
+ public function execute (string $ path ): AssetInterface ;
26
+ }
Original file line number Diff line number Diff line change 3
3
"description" : " Magento module responsible for the media gallery synchronization implementation API" ,
4
4
"require" : {
5
5
"php" : " ~7.3.0||~7.4.0" ,
6
- "magento/framework" : " *"
6
+ "magento/framework" : " *" ,
7
+ "magento/module-media-gallery-api" : " *"
7
8
},
8
9
"type" : " magento2-module" ,
9
10
"license" : [
Original file line number Diff line number Diff line change 12
12
use Magento \MediaGalleryApi \Api \Data \AssetInterface ;
13
13
use Magento \MediaGalleryApi \Api \Data \AssetInterfaceFactory ;
14
14
use Magento \MediaGalleryMetadataApi \Api \ExtractMetadataInterface ;
15
- use Magento \MediaGallerySynchronizationApi \Model \CreateAssetFromFile ;
15
+ use Magento \MediaGallerySynchronizationApi \Model \CreateAssetFromFileInterface ;
16
16
17
17
/**
18
18
* Add metadata to the asset created from file
@@ -52,12 +52,12 @@ public function __construct(
52
52
/**
53
53
* Add metadata to the asset
54
54
*
55
- * @param CreateAssetFromFile $createAssetFromFile
55
+ * @param CreateAssetFromFileInterface $subject
56
56
* @param AssetInterface $asset
57
57
* @return AssetInterface
58
58
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
59
59
*/
60
- public function afterExecute (CreateAssetFromFile $ createAssetFromFile , AssetInterface $ asset ): AssetInterface
60
+ public function afterExecute (CreateAssetFromFileInterface $ subject , AssetInterface $ asset ): AssetInterface
61
61
{
62
62
$ metadata = $ this ->extractMetadata ->execute (
63
63
$ this ->filesystem ->getDirectoryRead (DirectoryList::MEDIA )->getAbsolutePath ($ asset ->getPath ())
Original file line number Diff line number Diff line change 13
13
</argument >
14
14
</arguments >
15
15
</type >
16
- <type name =" Magento\MediaGallerySynchronizationApi\Model\CreateAssetFromFile " >
16
+ <type name =" Magento\MediaGallerySynchronizationApi\Model\CreateAssetFromFileInterface " >
17
17
<plugin name =" addMetadataToAssetCreatedFromFile" type =" Magento\MediaGallerySynchronizationMetadata\Plugin\CreateAssetFromFileMetadata" />
18
18
</type >
19
19
</config >
You can’t perform that action at this time.
0 commit comments