12 use Psr\Log\LoggerInterface as Logger;
108 $this->data = array_flip($this->pattern);
137 $this->data[
'prefix'] =
$prefix;
147 $this->data[
'suffix'] =
$suffix;
157 $this->data[
'start_value'] = $startValue;
167 $this->data[
'step'] = $step;
177 $this->data[
'max_value'] = $maxValue;
187 $this->data[
'warning_value'] = $warningValue;
198 return $this->appResource->getTableName(
201 $this->data[
'entity_type'],
202 $this->data[
'store_id']
216 $metadata = $this->resourceMetadata->loadByEntityTypeAndStore(
217 $this->data[
'entity_type'],
218 $this->data[
'store_id']
224 $this->data[
'is_active'] = 1;
225 $profile = $this->profileFactory->create(
227 'data' => array_intersect_key(
231 'prefix',
'suffix',
'start_value',
'step',
'max_value',
'warning_value',
232 'is_active',
'active_profile' 238 $profile->setHasDataChanges(
true);
239 $this->data[
'active_profile'] = $profile;
240 $metadata = $this->metaFactory->create(
242 'data' => array_intersect_key(
244 array_flip([
'entity_type',
'store_id',
'sequence_table',
'active_profile'])
248 $metadata->setHasDataChanges(
true);
250 $this->resourceMetadata->save($metadata);
251 $connection = $this->appResource->getConnection(
'sales');
252 if (!
$connection->isTableExists($this->data[
'sequence_table'])) {
254 $this->ddlSequence->getCreateSequenceDdl(
255 $this->data[
'sequence_table'],
256 $this->data[
'start_value']
261 $this->resourceMetadata->delete($metadata);
262 $this->logger->critical($e);
265 $this->data = array_flip($this->pattern);
setStartValue($startValue)
setWarningValue($warningValue)
setEntityType($entityType)
__construct(ResourceMetadata $resourceMetadata, MetaFactory $metaFactory, ProfileFactory $profileFactory, AppResource $appResource, DdlSequence $ddlSequence, Logger $logger)