File tree Expand file tree Collapse file tree 4 files changed +58
-14
lines changed
lib/internal/Magento/Framework Expand file tree Collapse file tree 4 files changed +58
-14
lines changed Original file line number Diff line number Diff line change 1777
1777
type =" Magento\Framework\Mail\MimeMessage" />
1778
1778
<preference for =" Magento\Framework\Mail\MimePartInterface"
1779
1779
type =" Magento\Framework\Mail\MimePart" />
1780
+ <type name =" Magento\Framework\DB\Adapter\AdapterInterface" >
1781
+ <plugin name =" execute_commit_callbacks" type =" Magento\Framework\Model\ExecuteCommitCallbacks" />
1782
+ </type >
1780
1783
</config >
Original file line number Diff line number Diff line change @@ -202,7 +202,9 @@ private function initializeUncompiled($classDefinitions = [])
202
202
private function generateIntercepted ($ classDefinitions )
203
203
{
204
204
$ config = [];
205
- foreach ($ this ->_scopeList ->getAllScopes () as $ scope ) {
205
+ $ scopes = $ this ->_scopeList ->getAllScopes ();
206
+ array_unshift ($ scopes , 'primary ' );
207
+ foreach (array_unique ($ scopes ) as $ scope ) {
206
208
$ config = array_replace_recursive ($ config , $ this ->_reader ->read ($ scope ));
207
209
}
208
210
unset($ config ['preferences ' ]);
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 \Framework \Model ;
9
+
10
+ use Magento \Framework \DB \Adapter \AdapterInterface ;
11
+ use Psr \Log \LoggerInterface ;
12
+
13
+ /**
14
+ * Execute added callbacks for transaction commit.
15
+ */
16
+ class ExecuteCommitCallbacks
17
+ {
18
+ /**
19
+ * @var LoggerInterface
20
+ */
21
+ private $ logger ;
22
+
23
+ public function __construct (LoggerInterface $ logger )
24
+ {
25
+ $ this ->logger = $ logger ;
26
+ }
27
+
28
+ /**
29
+ * Execute callbacks after commit.
30
+ *
31
+ * @param AdapterInterface $subject
32
+ * @param AdapterInterface $result
33
+ * @return AdapterInterface
34
+ * @SuppressWarnings(PHPMD.UnusedFormalParameter)
35
+ */
36
+ public function afterCommit (AdapterInterface $ subject , AdapterInterface $ result ): AdapterInterface
37
+ {
38
+ if ($ result ->getTransactionLevel () === 0 ) {
39
+ $ callbacks = CallbackPool::get (spl_object_hash ($ result ));
40
+ foreach ($ callbacks as $ callback ) {
41
+ try {
42
+ call_user_func ($ callback );
43
+ } catch (\Throwable $ e ) {
44
+ $ this ->logger ->critical ($ e );
45
+ }
46
+ }
47
+ }
48
+
49
+ return $ result ;
50
+ }
51
+ }
Original file line number Diff line number Diff line change @@ -87,19 +87,7 @@ public function addCommitCallback($callback)
87
87
public function commit ()
88
88
{
89
89
$ this ->getConnection ()->commit ();
90
- /**
91
- * Process after commit callbacks
92
- */
93
- if ($ this ->getConnection ()->getTransactionLevel () === 0 ) {
94
- $ callbacks = CallbackPool::get (spl_object_hash ($ this ->getConnection ()));
95
- try {
96
- foreach ($ callbacks as $ callback ) {
97
- call_user_func ($ callback );
98
- }
99
- } catch (\Exception $ e ) {
100
- $ this ->getLogger ()->critical ($ e );
101
- }
102
- }
90
+
103
91
return $ this ;
104
92
}
105
93
You can’t perform that action at this time.
0 commit comments