本文整理汇总了PHP中Magento\Framework\Model\AbstractModel::getStoreId方法的典型用法代码示例。如果您正苦于以下问题:PHP AbstractModel::getStoreId方法的具体用法?PHP AbstractModel::getStoreId怎么用?PHP AbstractModel::getStoreId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\Model\AbstractModel
的用法示例。
在下文中一共展示了AbstractModel::getStoreId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _beforeSave
/**
* Perform actions before object save
*
* @param \Magento\Framework\Model\AbstractModel $object
* @return $this
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function _beforeSave(\Magento\Framework\Model\AbstractModel $object)
{
if ($date = $object->getDateFrom()) {
$object->setDateFrom($this->dateTime->formatDate($date));
} else {
$object->setDateFrom(null);
}
if ($date = $object->getDateTo()) {
$object->setDateTo($this->dateTime->formatDate($date));
} else {
$object->setDateTo(null);
}
if (!is_null($object->getDateFrom()) && !is_null($object->getDateTo()) && (new \DateTime($object->getDateFrom()))->getTimestamp() > (new \DateTime($object->getDateTo()))->getTimestamp()) {
throw new \Magento\Framework\Exception\LocalizedException(__('The start date can\'t follow the end date.'));
}
$check = $this->_checkIntersection($object->getStoreId(), $object->getDateFrom(), $object->getDateTo(), $object->getId());
if ($check) {
throw new \Magento\Framework\Exception\LocalizedException(__('The date range for this design change overlaps another design change for the specified store.'));
}
if ($object->getDateFrom() === null) {
$object->setDateFrom(new \Zend_Db_Expr('null'));
}
if ($object->getDateTo() === null) {
$object->setDateTo(new \Zend_Db_Expr('null'));
}
parent::_beforeSave($object);
}
示例2: getStoreId
/**
* Get current store id or setted store id
*
* @return int
*/
public function getStoreId()
{
if ($storeId = parent::getStoreId()) {
return $storeId;
}
return $this->storeManager->getStore()->getId();
}
示例3: _afterDelete
/**
* Remove configuration data after delete store
*
* @param \Magento\Framework\Model\AbstractModel $model
* @return $this
*/
protected function _afterDelete(\Magento\Framework\Model\AbstractModel $model)
{
$where = ['scope = ?' => \Magento\Store\Model\ScopeInterface::SCOPE_STORES, 'scope_id = ?' => $model->getStoreId()];
$this->getConnection()->delete($this->getTable('core_config_data'), $where);
$this->configCache->clean();
return $this;
}
示例4: _beforeSave
/**
* Perform actions before object save
*
* @param \Magento\Framework\Model\AbstractModel $object
* @return $this
* @throws \Magento\Framework\Model\Exception
*/
public function _beforeSave(\Magento\Framework\Model\AbstractModel $object)
{
if ($date = $object->getDateFrom()) {
$object->setDateFrom($this->dateTime->formatDate($date));
} else {
$object->setDateFrom(null);
}
if ($date = $object->getDateTo()) {
$object->setDateTo($this->dateTime->formatDate($date));
} else {
$object->setDateTo(null);
}
if (!is_null($object->getDateFrom()) && !is_null($object->getDateTo()) && $this->dateTime->toTimestamp($object->getDateFrom()) > $this->dateTime->toTimestamp($object->getDateTo())) {
throw new \Magento\Framework\Model\Exception(__('Start date cannot be greater than end date.'));
}
$check = $this->_checkIntersection($object->getStoreId(), $object->getDateFrom(), $object->getDateTo(), $object->getId());
if ($check) {
throw new \Magento\Framework\Model\Exception(__('Your design change for the specified store intersects with another one, please specify another date range.'));
}
if ($object->getDateFrom() === null) {
$object->setDateFrom(new \Zend_Db_Expr('null'));
}
if ($object->getDateTo() === null) {
$object->setDateTo(new \Zend_Db_Expr('null'));
}
parent::_beforeSave($object);
}
示例5: processRelation
/**
* Save relations for Customer
*
* @param \Magento\Framework\Model\AbstractModel $customer
* @return void
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
public function processRelation(\Magento\Framework\Model\AbstractModel $customer)
{
$defaultBillingId = $customer->getData('default_billing');
$defaultShippingId = $customer->getData('default_shipping');
/** @var \Magento\Customer\Model\Address $address */
foreach ($customer->getAddresses() as $address) {
if ($address->getData('_deleted')) {
if ($address->getId() == $defaultBillingId) {
$customer->setData('default_billing', null);
}
if ($address->getId() == $defaultShippingId) {
$customer->setData('default_shipping', null);
}
$removedAddressId = $address->getId();
$address->delete();
// Remove deleted address from customer address collection
$customer->getAddressesCollection()->removeItemByKey($removedAddressId);
} else {
$address->setParentId($customer->getId())->setStoreId($customer->getStoreId())->setIsCustomerSaveTransaction(true)->save();
if (($address->getIsPrimaryBilling() || $address->getIsDefaultBilling()) && $address->getId() != $defaultBillingId) {
$customer->setData('default_billing', $address->getId());
}
if (($address->getIsPrimaryShipping() || $address->getIsDefaultShipping()) && $address->getId() != $defaultShippingId) {
$customer->setData('default_shipping', $address->getId());
}
}
}
$changedAddresses = [];
$changedAddresses['default_billing'] = $customer->getData('default_billing');
$changedAddresses['default_shipping'] = $customer->getData('default_shipping');
$customer->getResource()->getConnection()->update($customer->getResource()->getTable('customer_entity'), $changedAddresses, $customer->getResource()->getConnection()->quoteInto('entity_id = ?', $customer->getId()));
}
示例6: loadByQueryText
/**
* Custom load model only by query text (skip synonym for)
*
* @param AbstractModel $object
* @param string $value
* @return $this
*/
public function loadByQueryText(AbstractModel $object, $value)
{
$select = $this->getConnection()->select()->from($this->getMainTable())->where('query_text = ?', $value)->where('store_id = ?', $object->getStoreId())->limit(1);
$data = $this->getConnection()->fetchRow($select);
if ($data) {
$object->setData($data);
$this->_afterLoad($object);
}
return $this;
}
示例7: getCodeObjectByEntity
/**
* Get loaded Code object by Entity
*
* @param \Magento\Framework\Model\AbstractModel $entity
* @return \Magento\GoogleOptimizer\Model\Code
*/
public function getCodeObjectByEntity(\Magento\Framework\Model\AbstractModel $entity)
{
$this->_entity = $entity;
$this->_checkEntityIsEmpty();
if ($entity instanceof \Magento\Cms\Model\Page) {
$this->_codeModel->loadByEntityIdAndType($entity->getId(), $this->_getEntityType());
} else {
$this->_codeModel->loadByEntityIdAndType($entity->getId(), $this->_getEntityType(), $entity->getStoreId());
}
return $this->_codeModel;
}
示例8: generate
public function generate(\Magento\Framework\Model\AbstractModel $object)
{
if ($object->getData('identifier')) {
return;
}
$identifier = trim($object->getData('title'));
if (!$identifier) {
return;
}
$from = ['Á', 'À', 'Â', 'Ä', 'Ă', 'Ā', 'Ã', 'Å', 'Ą', 'Æ', 'Ć', 'Ċ', 'Ĉ', 'Č', 'Ç', 'Ď', 'Đ', 'Ð', 'É', 'È', 'Ė', 'Ê', 'Ë', 'Ě', 'Ē', 'Ę', 'Ə', 'Ġ', 'Ĝ', 'Ğ', 'Ģ', 'á', 'à', 'â', 'ä', 'ă', 'ā', 'ã', 'å', 'ą', 'æ', 'ć', 'ċ', 'ĉ', 'č', 'ç', 'ď', 'đ', 'ð', 'é', 'è', 'ė', 'ê', 'ë', 'ě', 'ē', 'ę', 'ə', 'ġ', 'ĝ', 'ğ', 'ģ', 'Ĥ', 'Ħ', 'I', 'Í', 'Ì', 'İ', 'Î', 'Ï', 'Ī', 'Į', 'IJ', 'Ĵ', 'Ķ', 'Ļ', 'Ł', 'Ń', 'Ň', 'Ñ', 'Ņ', 'Ó', 'Ò', 'Ô', 'Ö', 'Õ', 'Ő', 'Ø', 'Ơ', 'Œ', 'ĥ', 'ħ', 'ı', 'í', 'ì', 'i', 'î', 'ï', 'ī', 'į', 'ij', 'ĵ', 'ķ', 'ļ', 'ł', 'ń', 'ň', 'ñ', 'ņ', 'ó', 'ò', 'ô', 'ö', 'õ', 'ő', 'ø', 'ơ', 'œ', 'Ŕ', 'Ř', 'Ś', 'Ŝ', 'Š', 'Ş', 'Ť', 'Ţ', 'Þ', 'Ú', 'Ù', 'Û', 'Ü', 'Ŭ', 'Ū', 'Ů', 'Ų', 'Ű', 'Ư', 'Ŵ', 'Ý', 'Ŷ', 'Ÿ', 'Ź', 'Ż', 'Ž', 'ŕ', 'ř', 'ś', 'ŝ', 'š', 'ş', 'ß', 'ť', 'ţ', 'þ', 'ú', 'ù', 'û', 'ü', 'ŭ', 'ū', 'ů', 'ų', 'ű', 'ư', 'ŵ', 'ý', 'ŷ', 'ÿ', 'ź', 'ż', 'ž', 'А', 'Б', 'В', 'Г', 'Д', 'Е', 'Ё', 'Ж', 'З', 'И', 'Й', 'К', 'Л', 'М', 'Н', 'О', 'П', 'Р', 'С', 'Т', 'У', 'Ф', 'Х', 'Ц', 'Ч', 'Ш', 'Щ', 'Ъ', 'Ы', 'Ь', 'Э', 'Ю', 'Я', 'а', 'б', 'в', 'г', 'д', 'е', 'ё', 'ж', 'з', 'и', 'й', 'к', 'л', 'м', 'н', 'о', 'п', 'р', 'с', 'т', 'у', 'ф', 'х', 'ц', 'ч', 'ш', 'щ', 'ъ', 'ы', 'ь', 'э', 'ю', 'я', 'І', 'і', 'Ї', 'ї', 'Є', 'є', ' & ', '&'];
$to = ['A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'AE', 'C', 'C', 'C', 'C', 'C', 'D', 'D', 'D', 'E', 'E', 'E', 'E', 'E', 'E', 'E', 'E', 'G', 'G', 'G', 'G', 'G', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'ae', 'c', 'c', 'c', 'c', 'c', 'd', 'd', 'd', 'e', 'e', 'e', 'e', 'e', 'e', 'e', 'e', 'g', 'g', 'g', 'g', 'g', 'H', 'H', 'I', 'I', 'I', 'I', 'I', 'I', 'I', 'I', 'IJ', 'J', 'K', 'L', 'L', 'N', 'N', 'N', 'N', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'CE', 'h', 'h', 'i', 'i', 'i', 'i', 'i', 'i', 'i', 'i', 'ij', 'j', 'k', 'l', 'l', 'n', 'n', 'n', 'n', 'o', 'o', 'o', 'o', 'o', 'o', 'o', 'o', 'o', 'R', 'R', 'S', 'S', 'S', 'S', 'T', 'T', 'T', 'U', 'U', 'U', 'U', 'U', 'U', 'U', 'U', 'U', 'U', 'W', 'Y', 'Y', 'Y', 'Z', 'Z', 'Z', 'r', 'r', 's', 's', 's', 's', 'B', 't', 't', 'b', 'u', 'u', 'u', 'u', 'u', 'u', 'u', 'u', 'u', 'u', 'w', 'y', 'y', 'y', 'z', 'z', 'z', 'A', 'B', 'V', 'H', 'D', 'e', 'Io', 'Z', 'Z', 'Y', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'R', 'S', 'T', 'U', 'F', 'Ch', 'C', 'Ch', 'Sh', 'Shtch', '', 'Y', '', 'E', 'Iu', 'Ia', 'a', 'b', 'v', 'h', 'd', 'e', 'io', 'z', 'z', 'y', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'r', 's', 't', 'u', 'f', 'ch', 'c', 'ch', 'sh', 'shtch', '', 'y', '', 'e', 'iu', 'ia', 'I', 'i', 'Ji', 'ji', 'Je', 'je', '-and-', '-and-'];
$identifier = str_replace($from, $to, $identifier);
$identifier = mb_strtolower($identifier);
$identifier = preg_replace('/[^A-Za-z0-9-]+/', '-', $identifier);
$identifier = preg_replace('/[--]+/', '-', $identifier);
$identifier = trim($identifier, '-');
$post = $this->_postFactory->create();
$category = $this->_categoryFactory->create();
$number = 1;
while (true) {
$finalIdentifier = $identifier . ($number > 1 ? '-' . $number : '');
$postId = $post->checkIdentifier($finalIdentifier, $object->getStoreId());
$categoryId = $category->checkIdentifier($finalIdentifier, $object->getStoreId());
if (!$postId && !$categoryId) {
break;
} else {
if ($postId && $postId == $object->getId() && $object instanceof \Magefan\Blog\Model\Post) {
break;
}
if ($categoryId && $categoryId == $object->getId() && $object instanceof \Magefan\Blog\Model\Category) {
break;
}
}
$number++;
}
$object->setData('identifier', $finalIdentifier);
}
示例9: _setAttributeValue
/**
* Set attribute value
*
* @param \Magento\Framework\Model\AbstractModel $model
* @return $this
*/
protected function _setAttributeValue(\Magento\Framework\Model\AbstractModel $model)
{
$storeId = $model->getStoreId();
$defaultStoreId = \Magento\Store\Model\Store::DEFAULT_STORE_ID;
if (!isset($this->_entityAttributeValues[$model->getId()])) {
return $this;
}
$productValues = $this->_entityAttributeValues[$model->getId()];
if (!isset($productValues[$storeId]) && !isset($productValues[$defaultStoreId])) {
return $this;
}
$value = isset($productValues[$storeId]) ? $productValues[$storeId] : $productValues[$defaultStoreId];
$value = $this->_prepareDatetimeValue($value, $model);
$value = $this->_prepareMultiselectValue($value, $model);
$model->setData($this->getAttribute(), $value);
return $this;
}
示例10: aroundSave
/**
* @param \Magento\Sales\Model\Spi\InvoiceResourceInterface $subject
* @param \Closure $proceed
*
* I include both the extended AbstractModel and implemented Interface here for the IDE's benefit
* @param \Magento\Framework\Model\AbstractModel|\Magento\Sales\Api\Data\InvoiceInterface $entity
* @return \Magento\Sales\Model\Spi\InvoiceResourceInterface
* @throws \Magento\Framework\Exception\CouldNotSaveException
*/
public function aroundSave(InvoiceResourceInterface $subject, \Closure $proceed, AbstractModel $entity)
{
// Check to see if this is a newly created entity and store the determination for later evaluation after
// the entity is saved via plugin closure. After the entity is saved it will not be listed as new any longer.
$isObjectNew = $entity->isObjectNew();
// Save AvaTax extension attributes
if ($this->avaTaxConfig->isModuleEnabled($entity->getStoreId())) {
// check to see if any extension attributes exist and set them on the model for saving to the db
$extensionAttributes = $entity->getExtensionAttributes();
if ($extensionAttributes && $extensionAttributes->getAvataxIsUnbalanced() !== null) {
$entity->setData('avatax_is_unbalanced', $extensionAttributes->getAvataxIsUnbalanced());
}
if ($extensionAttributes && $extensionAttributes->getBaseAvataxTaxAmount() !== null) {
$entity->setData('base_avatax_tax_amount', $extensionAttributes->getBaseAvataxTaxAmount());
}
// Updating a field to trigger a change to the record when avatax_is_unbalanced and base_avatax_tax_amount
// are both false or 0 which evaluate the same as null in the isModified check
if ($extensionAttributes && ($extensionAttributes->getAvataxIsUnbalanced() !== null && ($entity->getOrigData('avatax_is_unbalanced') === null || $extensionAttributes->getAvataxIsUnbalanced() != $entity->getOrigData('avatax_is_unbalanced')) || $extensionAttributes->getBaseAvataxTaxAmount() !== null && ($entity->getOrigData('base_avatax_tax_amount') === null || $extensionAttributes->getBaseAvataxTaxAmount() != $entity->getOrigData('base_avatax_tax_amount')))) {
$entity->setUpdatedAt($this->dateTime->gmtDate());
}
}
/** @var \Magento\Sales\Model\Spi\InvoiceResourceInterface $resultEntity */
$resultEntity = $proceed($entity);
/** @var \Magento\Sales\Model\Order $order */
$order = $entity->getOrder();
$isVirtual = $order->getIsVirtual();
$address = $isVirtual ? $entity->getBillingAddress() : $entity->getShippingAddress();
$storeId = $entity->getStoreId();
// Queue the entity to be sent to AvaTax
if ($this->avaTaxConfig->isModuleEnabled($entity->getStoreId()) && $this->avaTaxConfig->getTaxMode($entity->getStoreId()) == Config::TAX_MODE_ESTIMATE_AND_SUBMIT && $this->avaTaxConfig->isAddressTaxable($address, $storeId)) {
// Add this entity to the avatax processing queue if this is a new entity
if ($isObjectNew) {
/** @var Queue $queue */
$queue = $this->queueFactory->create();
$queue->build($entity->getStoreId(), Queue::ENTITY_TYPE_CODE_INVOICE, $entity->getEntityId(), $entity->getIncrementId(), Queue::QUEUE_STATUS_PENDING);
$queue->save();
$this->avaTaxLogger->debug(__('Added entity to the queue'), ['queue_id' => $queue->getId(), 'entity_type_code' => Queue::ENTITY_TYPE_CODE_INVOICE, 'entity_id' => $entity->getEntityId()]);
}
}
return $resultEntity;
}
示例11: _afterSave
/**
* Assign category to store views
*
* @param \Magento\Framework\Model\AbstractModel $object
* @return $this
*/
protected function _afterSave(\Magento\Framework\Model\AbstractModel $object)
{
$oldStores = $this->lookupStoreIds($object->getId());
$newStores = (array) $object->getStores();
if (empty($newStores)) {
$newStores = (array) $object->getStoreId();
}
$table = $this->getTable('magefan_blog_category_store');
$insert = array_diff($newStores, $oldStores);
$delete = array_diff($oldStores, $newStores);
if ($delete) {
$where = ['category_id = ?' => (int) $object->getId(), 'store_id IN (?)' => $delete];
$this->getConnection()->delete($table, $where);
}
if ($insert) {
$data = [];
foreach ($insert as $storeId) {
$data[] = ['category_id' => (int) $object->getId(), 'store_id' => (int) $storeId];
}
$this->getConnection()->insertMultiple($table, $data);
}
return parent::_afterSave($object);
}
示例12: _afterSave
/**
* Assign page to store views
*
* @param \Magento\Framework\Model\AbstractModel $object
* @return $this
*/
protected function _afterSave(\Magento\Framework\Model\AbstractModel $object)
{
$oldStores = $this->lookupStoreIds($object->getId());
$newStores = (array) $object->getStores();
if (empty($newStores)) {
$newStores = (array) $object->getStoreId();
}
$table = $this->getTable('cms_page_store');
$insert = array_diff($newStores, $oldStores);
$delete = array_diff($oldStores, $newStores);
if ($delete) {
$where = array('page_id = ?' => (int) $object->getId(), 'store_id IN (?)' => $delete);
$this->_getWriteAdapter()->delete($table, $where);
}
if ($insert) {
$data = array();
foreach ($insert as $storeId) {
$data[] = array('page_id' => (int) $object->getId(), 'store_id' => (int) $storeId);
}
$this->_getWriteAdapter()->insertMultiple($table, $data);
}
return parent::_afterSave($object);
}
示例13: _saveValueTitles
/**
* Save titles
*
* @param \Magento\Framework\Model\AbstractModel $object
* @return void
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
protected function _saveValueTitles(\Magento\Framework\Model\AbstractModel $object)
{
$connection = $this->getConnection();
$titleTableName = $this->getTable('catalog_product_option_title');
foreach ([\Magento\Store\Model\Store::DEFAULT_STORE_ID, $object->getStoreId()] as $storeId) {
$existInCurrentStore = $this->getColFromOptionTable($titleTableName, (int) $object->getId(), (int) $storeId);
$existInDefaultStore = $this->getColFromOptionTable($titleTableName, (int) $object->getId(), \Magento\Store\Model\Store::DEFAULT_STORE_ID);
if ($object->getTitle()) {
if ($existInCurrentStore) {
if ($object->getStoreId() == $storeId) {
$data = $this->_prepareDataForTable(new \Magento\Framework\DataObject(['title' => $object->getTitle()]), $titleTableName);
$connection->update($titleTableName, $data, ['option_id = ?' => $object->getId(), 'store_id = ?' => $storeId]);
}
} else {
// we should insert record into not default store only of if it does not exist in default store
if ($storeId == \Magento\Store\Model\Store::DEFAULT_STORE_ID && !$existInDefaultStore || $storeId != \Magento\Store\Model\Store::DEFAULT_STORE_ID && !$existInCurrentStore) {
$data = $this->_prepareDataForTable(new \Magento\Framework\DataObject(['option_id' => $object->getId(), 'store_id' => $storeId, 'title' => $object->getTitle()]), $titleTableName);
$connection->insert($titleTableName, $data);
}
}
} else {
if ($object->getId() && $object->getStoreId() > \Magento\Store\Model\Store::DEFAULT_STORE_ID && $storeId) {
$connection->delete($titleTableName, ['option_id = ?' => $object->getId(), 'store_id = ?' => $object->getStoreId()]);
}
}
}
}
示例14: _saveValueTitles
/**
* Save option value title data
*
* @param \Magento\Framework\Model\AbstractModel $object
* @return void
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
protected function _saveValueTitles(\Magento\Framework\Model\AbstractModel $object)
{
foreach ([\Magento\Store\Model\Store::DEFAULT_STORE_ID, $object->getStoreId()] as $storeId) {
$titleTable = $this->getTable('catalog_product_option_type_title');
$select = $this->_getReadAdapter()->select()->from($titleTable, ['option_type_id'])->where('option_type_id = ?', (int) $object->getId())->where('store_id = ?', (int) $storeId);
$optionTypeId = $this->_getReadAdapter()->fetchOne($select);
$existInCurrentStore = $this->getOptionIdFromOptionTable($titleTable, (int) $object->getId(), (int) $storeId);
if ($object->getTitle()) {
if ($existInCurrentStore) {
if ($storeId == $object->getStoreId()) {
$where = ['option_type_id = ?' => (int) $optionTypeId, 'store_id = ?' => $storeId];
$bind = ['title' => $object->getTitle()];
$this->_getWriteAdapter()->update($titleTable, $bind, $where);
}
} else {
$existInDefaultStore = $this->getOptionIdFromOptionTable($titleTable, (int) $object->getId(), \Magento\Store\Model\Store::DEFAULT_STORE_ID);
// we should insert record into not default store only of if it does not exist in default store
if ($storeId == \Magento\Store\Model\Store::DEFAULT_STORE_ID && !$existInDefaultStore || $storeId != \Magento\Store\Model\Store::DEFAULT_STORE_ID && !$existInCurrentStore) {
$bind = ['option_type_id' => (int) $object->getId(), 'store_id' => $storeId, 'title' => $object->getTitle()];
$this->_getWriteAdapter()->insert($titleTable, $bind);
}
}
} else {
if ($storeId && $optionTypeId && $object->getStoreId() > \Magento\Store\Model\Store::DEFAULT_STORE_ID) {
$where = ['option_type_id = ?' => (int) $optionTypeId, 'store_id = ?' => $storeId];
$this->_getWriteAdapter()->delete($titleTable, $where);
}
}
}
}
示例15: _beforeSave
/**
* Perform actions before object save
*
* @param \Magento\Framework\Model\AbstractModel|\Magento\Framework\Object $object
* @return $this
*/
protected function _beforeSave(\Magento\Framework\Model\AbstractModel $object)
{
if ($this->_useIncrementId && !$object->getIncrementId()) {
/* @var $entityType \Magento\Eav\Model\Entity\Type */
$entityType = $this->_eavEntityTypeFactory->create()->loadByCode($this->_entityTypeForIncrementId);
$object->setIncrementId($entityType->fetchNewIncrementId($object->getStoreId()));
}
parent::_beforeSave($object);
return $this;
}