DigiComp.Sequence/README.md

24 lines
825 B
Markdown
Raw Permalink Normal View History

2021-09-10 12:37:11 +02:00
# DigiComp.Sequence
2016-06-24 20:57:06 +02:00
2023-02-18 21:32:19 +01:00
![Build status](https://ci.digital-competence.de/api/badges/Packages/DigiComp.FlowObjectResolving/status.svg)
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:
2022-02-10 15:57:40 +01:00
2021-09-10 12:37:11 +02:00
```php
2023-02-18 21:10:01 +01:00
/**
* @param SequenceGenerator $sequenceGenerator
*/
public function __construct(SequenceGenerator $sequenceNumberGenerator)
{
$this->orderId = $sequenceGenerator->getNextNumberFor($this);
}
2021-09-10 12:37:11 +02:00
```
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.