Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
2 / 2 |
AutoincrementSequencer | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
getNextSequence | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
<?php | |
declare(strict_types = 1); | |
namespace Siesta\Sequencer; | |
use Siesta\Database\ConnectionFactory; | |
class AutoincrementSequencer implements Sequencer | |
{ | |
const NAME = "autoincrement"; | |
const DB_TYPE = "INT"; | |
const PHP_TYPE = "int"; | |
/** | |
* @param string $tableName | |
* @param string|null $connectionName | |
* | |
* @return int | |
*/ | |
public function getNextSequence(string $tableName, string $connectionName = null) | |
{ | |
$connection = ConnectionFactory::getConnection($connectionName); | |
return $connection->getSequence($tableName); | |
} | |
} |