pimcore/number-sequence-generator

Installs: 116 917

Dependents: 1

Suggesters: 0

Security: 0

Stars: 6

Watchers: 11

Forks: 4

Open Issues: 0

Type:pimcore-bundle

v1.0.6 2021-08-02 13:36 UTC

This package is auto-updated.

Last update: 2022-01-15 13:03:50 UTC


README

Continues numbers

Generates continous numbers for example for order numbers or customer numbers.

public function exampleAction(Pimcore\Bundle\NumberSequenceGeneratorBundle\Generator $generator) {
    /*
    * Generates the next order number (increments current order number by 1)
    * If no order number was generated before it will start with 10000
    */
    $next = $generator->getNext('ordernumber', 10000);

    /*
    * Receive the current order number without incrementing the counter.
    */
    $current = $generator->getCurrent('ordernumber');

    /*
    * Sets the order number to 35017 in the database.
    */
    $generator->setCurrent('ordernumber', 35017);
}

Random numbers (either numeric or alphanumeric)

Generates unique random numbers.

public function __construct(Generator $generator)
{
    $this->generator = $generator;
}

public function generateCode()
{
    $code = $this->generator->generateCode("vouchercode", \Pimcore\Bundle\NumberSequenceGeneratorBundle\RandomGenerator::ALPHANUMERIC, 32);
}