Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
SequenceCreatorObserver.php
Go to the documentation of this file.
1 <?php
7 
13 
18 {
22  private $sequenceBuilder;
23 
27  private $entityPool;
28 
32  private $sequenceConfig;
33 
41  public function __construct(
42  Builder $sequenceBuilder,
43  EntityPool $entityPool,
44  Config $sequenceConfig
45  ) {
46  $this->sequenceBuilder = $sequenceBuilder;
47  $this->entityPool = $entityPool;
48  $this->sequenceConfig = $sequenceConfig;
49  }
50 
55  public function execute(EventObserver $observer)
56  {
57  $storeId = $observer->getData('store')->getId();
58  foreach ($this->entityPool->getEntities() as $entityType) {
59  $this->sequenceBuilder->setPrefix($storeId)
60  ->setSuffix($this->sequenceConfig->get('suffix'))
61  ->setStartValue($this->sequenceConfig->get('startValue'))
62  ->setStoreId($storeId)
63  ->setStep($this->sequenceConfig->get('step'))
64  ->setWarningValue($this->sequenceConfig->get('warningValue'))
65  ->setMaxValue($this->sequenceConfig->get('maxValue'))
66  ->setEntityType($entityType)
67  ->create();
68  }
69  return $this;
70  }
71 }
__construct(Builder $sequenceBuilder, EntityPool $entityPool, Config $sequenceConfig)