SequenceGenerator
extends AbstractIdGenerator
in package
implements
Serializable
Represents an ID generator that uses a database sequence.
Interfaces, Classes, Traits and Enums
- Serializable
Table of Contents
- $_allocationSize : int
- The allocation size of the sequence.
- $_maxValue : int|null
- $_nextValue : int
- $_sequenceName : string
- The name of the sequence.
- __construct() : mixed
- Initializes a new sequence generator.
- __serialize() : array<string, mixed>
- __unserialize() : void
- generate() : mixed
- Generates an identifier for an entity.
- getCurrentMaxValue() : int|null
- Gets the maximum value of the currently allocated bag of values.
- getNextValue() : int
- Gets the next value that will be returned by generate().
- isPostInsertGenerator() : bool
- Gets whether this generator is a post-insert generator which means that {@link generate()} must be called after the entity has been inserted into the database.
- serialize() : string
- unserialize() : void
Properties
$_allocationSize
The allocation size of the sequence.
private
int
$_allocationSize
$_maxValue
private
int|null
$_maxValue
= null
$_nextValue
private
int
$_nextValue
= 0
$_sequenceName
The name of the sequence.
private
string
$_sequenceName
Methods
__construct()
Initializes a new sequence generator.
public
__construct(string $sequenceName, int $allocationSize) : mixed
Parameters
- $sequenceName : string
-
The name of the sequence.
- $allocationSize : int
-
The allocation size of the sequence.
Return values
mixed —__serialize()
public
__serialize() : array<string, mixed>
Return values
array<string, mixed> —__unserialize()
public
__unserialize(array<string, mixed> $data) : void
Parameters
- $data : array<string, mixed>
Return values
void —generate()
Generates an identifier for an entity.
public
generate(EntityManager $em, mixed $entity) : mixed
Parameters
- $em : EntityManager
- $entity : mixed
Return values
mixed —getCurrentMaxValue()
Gets the maximum value of the currently allocated bag of values.
public
getCurrentMaxValue() : int|null
Return values
int|null —getNextValue()
Gets the next value that will be returned by generate().
public
getNextValue() : int
Return values
int —isPostInsertGenerator()
Gets whether this generator is a post-insert generator which means that {@link generate()} must be called after the entity has been inserted into the database.
public
isPostInsertGenerator() : bool
By default, this method returns FALSE. Generators that have this requirement must override this method and return TRUE.
Return values
bool —serialize()
public
serialize() : string
Tags
Return values
string —unserialize()
public
unserialize(string $serialized) : void
Parameters
- $serialized : string