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 55 */
66namespace Magento \Indexer \Model \ResourceModel \Indexer ;
77
8+ use Magento \Framework \Indexer \StateInterface ;
9+
10+ /**
11+ * Resource model for indexer state
12+ */
813class State extends \Magento \Framework \Model \ResourceModel \Db \AbstractDb
914{
1015 /**
@@ -17,4 +22,22 @@ protected function _construct()
1722 $ this ->_init ('indexer_state ' , 'state_id ' );
1823 $ this ->addUniqueField (['field ' => ['indexer_id ' ], 'title ' => __ ('State for the same indexer ' )]);
1924 }
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+ }
2043}
You can’t perform that action at this time.
0 commit comments