Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
State.php
Go to the documentation of this file.
1 <?php
7 
9 
11 {
17  protected $_eventPrefix = 'indexer_state';
18 
24  protected $_eventObject = 'indexer_state';
25 
33  public function __construct(
34  \Magento\Framework\Model\Context $context,
35  \Magento\Framework\Registry $registry,
37  \Magento\Indexer\Model\ResourceModel\Indexer\State\Collection $resourceCollection,
38  array $data = []
39  ) {
40  if (!isset($data['status'])) {
41  $data['status'] = self::STATUS_INVALID;
42  }
43  parent::__construct($context, $registry, $resource, $resourceCollection, $data);
44  }
45 
51  public function getIndexerId()
52  {
53  return parent::getIndexerId();
54  }
55 
62  public function setIndexerId($value)
63  {
64  return parent::setIndexerId($value);
65  }
66 
72  public function getStatus()
73  {
74  return parent::getStatus();
75  }
76 
82  public function getUpdated()
83  {
84  return parent::getUpdated();
85  }
86 
93  public function setUpdated($value)
94  {
95  return parent::setUpdated($value);
96  }
97 
104  public function loadByIndexer($indexerId)
105  {
106  $this->load($indexerId, 'indexer_id');
107  if (!$this->getId()) {
108  $this->setIndexerId($indexerId);
109  }
110  return $this;
111  }
112 
119  public function setStatus($status)
120  {
121  return parent::setStatus($status);
122  }
123 
129  public function beforeSave()
130  {
131  $this->setUpdated(time());
132  return parent::beforeSave();
133  }
134 }
__construct(\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Indexer\Model\ResourceModel\Indexer\State $resource, \Magento\Indexer\Model\ResourceModel\Indexer\State\Collection $resourceCollection, array $data=[])
Definition: State.php:33
$resource
Definition: bulk.php:12
$value
Definition: gender.phtml:16
$status
Definition: order_status.php:8