Use temporary negative IDs for rows created in a draft Changeset
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace App\Tables;
|
||||
|
||||
/**
|
||||
* Utility for allocating & assigning temporary row IDs
|
||||
* for rows in a changeset
|
||||
*/
|
||||
class DraftRowNumerator extends BaseNumerator
|
||||
{
|
||||
/**
|
||||
* Create a numerator for the given number of rows.
|
||||
*
|
||||
* @param int $capacity - how many
|
||||
*/
|
||||
public function __construct(Changeset $changeset, $capacity)
|
||||
{
|
||||
parent::__construct([$changeset->nextRowID - $capacity + 1, $changeset->nextRowID]);
|
||||
$changeset->nextRowID -= $capacity;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user