DigiComp.Sequence/README.md

21 lines
709 B
Markdown
Raw Normal View History

2021-09-10 12:37:11 +02:00
# DigiComp.Sequence
2016-06-24 20:57:06 +02:00
2021-09-10 12:37:11 +02:00
This is a very simple tool, helping in generation of gapless sequences. For this task it relies on key integrity of the
database of your choice.
2016-06-24 20:57:06 +02:00
Usage is quite simple also:
2021-09-10 12:37:11 +02:00
```php
/**
* @param SequenceNumberGenerator $sequenceNumberGenerator
*/
public function __construct(SequenceNumberGenerator $sequenceNumberGenerator)
{
$this->orderId = $sequenceNumberGenerator->getNextNumberFor($this);
}
```
2016-06-24 20:57:06 +02:00
2021-09-10 12:37:11 +02:00
`getNextNumberFor` allows you to give an object (which will be resolved to its FQCN) or a custom sequence name.
2016-06-24 20:57:06 +02:00
2021-09-22 11:34:34 +02:00
The `SequenceCommandController` helps you to set the last sequence number, in case of migrations or similar. See
`./flow help sequence:setlastnumberfor` if interested.