PHP code example of pimcore / number-sequence-generator
1. Go to this page and download the library: Download pimcore/number-sequence-generator library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
pimcore / number-sequence-generator example snippets
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);
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.