pimcore/number-sequence-generator

Pimcore 数字序列生成器

安装次数: 378,313

依赖项: 1

建议者: 0

安全性: 0

星标: 11

关注者: 11

分支: 4

开放问题: 0

类型:pimcore-bundle

v2.0.1 2024-05-03 08:33 UTC

This package is auto-updated.

Last update: 2024-09-16 08:03:50 UTC


README

连续数字

生成连续数字,例如用于订单号或客户号。

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);
}

随机数字(可以是数字或字母数字)

生成唯一的随机数字。

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

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

升级到 Pimcore XI

  • 更新到 Pimcore X 的最新(允许)捆绑版本,并执行所有迁移。
  • 然后更新到 Pimcore XI。

文档概览