Skip to main content

Shopware6 - Id get next id for entity

Category: Shopware
shopware-logo

A quick example how to retrieve the next id for an entity in Shopware6.

$documentNumber = $this->valueGenerator->getValue('document_invoice', $context, $event->getSalesChannelId());

Service declaration

<argument type="service" id="Shopware\Core\System\NumberRange\ValueGenerator\NumberRangeValueGeneratorInterface"/>