File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
app/code/Magento/Indexer/Model/ResourceModel/Indexer Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 5
5
*/
6
6
namespace Magento \Indexer \Model \ResourceModel \Indexer ;
7
7
8
+ use Magento \Framework \Indexer \StateInterface ;
9
+
10
+ /**
11
+ * Resource model for indexer state
12
+ */
8
13
class State extends \Magento \Framework \Model \ResourceModel \Db \AbstractDb
9
14
{
10
15
/**
@@ -17,4 +22,22 @@ protected function _construct()
17
22
$ this ->_init ('indexer_state ' , 'state_id ' );
18
23
$ this ->addUniqueField (['field ' => ['indexer_id ' ], 'title ' => __ ('State for the same indexer ' )]);
19
24
}
25
+
26
+ /**
27
+ * @inheritDoc
28
+ */
29
+ protected function prepareDataForUpdate ($ object )
30
+ {
31
+ $ data = parent ::prepareDataForUpdate ($ object );
32
+
33
+ if (isset ($ data ['status ' ]) && StateInterface::STATUS_VALID === $ data ['status ' ]) {
34
+ $ data ['status ' ] = $ this ->getConnection ()->getCheckSql (
35
+ $ this ->getConnection ()->quoteInto ('status = ? ' , StateInterface::STATUS_WORKING ),
36
+ $ this ->getConnection ()->quote ($ data ['status ' ]),
37
+ 'status '
38
+ );
39
+ }
40
+
41
+ return $ data ;
42
+ }
20
43
}
You can’t perform that action at this time.
0 commit comments