Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AutoIncrement.php
Go to the documentation of this file.
1 <?php
8 
13 {
17  private $resource;
18 
22  private $incrementValue;
23 
27  public function __construct(\Magento\Framework\App\ResourceConnection $resource)
28  {
29  $this->resource = $resource;
30  }
31 
37  public function getIncrement()
38  {
39  if ($this->incrementValue === null) {
40  $increment = $this->resource->getConnection()->fetchRow('SHOW VARIABLES LIKE "auto_increment_increment"');
41  $this->incrementValue = !empty($increment['Value']) ? (int)$increment['Value'] : 1;
42  }
43  return $this->incrementValue;
44  }
45 }
$resource
Definition: bulk.php:12
__construct(\Magento\Framework\App\ResourceConnection $resource)