File tree 3 files changed +63
-6
lines changed
MediaContentSynchronization/Model
MediaContentSynchronizationApi/Api
MediaGallerySynchronization/Model
3 files changed +63
-6
lines changed Original file line number Diff line number Diff line change 7
7
8
8
namespace Magento \MediaContentSynchronization \Model ;
9
9
10
+ use Magento \Framework \Exception \LocalizedException ;
11
+ use Magento \MediaContentSynchronizationApi \Api \SynchronizeIdentitiesInterface ;
10
12
use Magento \MediaContentSynchronizationApi \Api \SynchronizeInterface ;
11
13
12
14
/**
@@ -19,19 +21,34 @@ class Consume
19
21
*/
20
22
private $ synchronize ;
21
23
24
+ /**
25
+ * @var SynchronizeIdentitiesInterface
26
+ */
27
+ private $ synchronizeIdentities ;
28
+
22
29
/**
23
30
* @param SynchronizeInterface $synchronize
31
+ * @param SynchronizeIdentitiesInterface $synchronizeIdentities
24
32
*/
25
- public function __construct (SynchronizeInterface $ synchronize )
26
- {
33
+ public function __construct (
34
+ SynchronizeInterface $ synchronize ,
35
+ SynchronizeIdentitiesInterface $ synchronizeIdentities
36
+ ) {
27
37
$ this ->synchronize = $ synchronize ;
38
+ $ this ->synchronizeIdentities = $ synchronizeIdentities ;
28
39
}
29
40
30
41
/**
31
42
* Run media files synchronization.
43
+ * @param string[] $message
44
+ * @throws LocalizedException
32
45
*/
33
- public function execute () : void
46
+ public function execute (array $ message ) : void
34
47
{
35
48
$ this ->synchronize ->execute ();
49
+
50
+ if (!empty ($ message )) {
51
+ $ this ->synchronizeIdentities ->execute ($ message );
52
+ }
36
53
}
37
54
}
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 \MediaContentSynchronizationApi \Api ;
9
+
10
+ use Magento \MediaContentApi \Api \Data \ContentIdentityInterface ;
11
+
12
+ /**
13
+ * Synchronize bulk assets and contents
14
+ */
15
+ interface SynchronizeIdentitiesInterface
16
+ {
17
+ /**
18
+ * Synchronize media contents
19
+ *
20
+ * @param ContentIdentityInterface[] $contentIdentities
21
+ */
22
+ public function execute (array $ contentIdentities ): void ;
23
+ }
Original file line number Diff line number Diff line change 7
7
8
8
namespace Magento \MediaGallerySynchronization \Model ;
9
9
10
+ use Magento \Framework \Exception \LocalizedException ;
11
+ use Magento \MediaGallerySynchronizationApi \Api \SynchronizeFilesInterface ;
10
12
use Magento \MediaGallerySynchronizationApi \Api \SynchronizeInterface ;
11
13
12
14
/**
@@ -19,19 +21,34 @@ class Consume
19
21
*/
20
22
private $ synchronize ;
21
23
24
+ /**
25
+ * @var SynchronizeFilesInterface
26
+ */
27
+ private $ synchronizeFiles ;
28
+
22
29
/**
23
30
* @param SynchronizeInterface $synchronize
31
+ * @param SynchronizeFilesInterface $synchronizeFiles
24
32
*/
25
- public function __construct (SynchronizeInterface $ synchronize )
26
- {
33
+ public function __construct (
34
+ SynchronizeInterface $ synchronize ,
35
+ SynchronizeFilesInterface $ synchronizeFiles
36
+ ) {
27
37
$ this ->synchronize = $ synchronize ;
38
+ $ this ->synchronizeFiles = $ synchronizeFiles ;
28
39
}
29
40
30
41
/**
31
42
* Run media files synchronization.
43
+ * @param string[] $message
44
+ * @throws LocalizedException
32
45
*/
33
- public function execute () : void
46
+ public function execute (array $ message ) : void
34
47
{
35
48
$ this ->synchronize ->execute ();
49
+
50
+ if (!empty ($ message )) {
51
+ $ this ->synchronizeFiles ->execute ($ message );
52
+ }
36
53
}
37
54
}
You can’t perform that action at this time.
0 commit comments