27 private $lastIncrementId;
52 $pattern = self::DEFAULT_PATTERN
55 $this->connection =
$resource->getConnection(
'sales');
56 $this->pattern = $pattern;
66 if (!isset($this->lastIncrementId)) {
72 $this->meta->getActiveProfile()->getPrefix(),
73 $this->calculateCurrentValue(),
74 $this->meta->getActiveProfile()->getSuffix()
85 $this->connection->insert($this->meta->getSequenceTable(), []);
86 $this->lastIncrementId = $this->connection->lastInsertId($this->meta->getSequenceTable());
95 private function calculateCurrentValue()
97 return ($this->lastIncrementId - $this->meta->getActiveProfile()->getStartValue())
98 * $this->meta->getActiveProfile()->getStep() + $this->meta->getActiveProfile()->getStartValue();
__construct(Meta $meta, AppResource $resource, $pattern=self::DEFAULT_PATTERN)