1
0
mirror of synced 2025-01-07 17:47:10 +03:00
doctrine2/lib/Doctrine/Id/SequenceGenerator.php
2008-09-07 13:48:40 +00:00

26 lines
583 B
PHP

<?php
class Doctrine_Id_SequenceGenerator extends Doctrine_Id_AbstractIdGenerator
{
private $_sequenceName;
public function __construct($sequenceName)
{
$this->_sequenceName = $sequenceName;
}
/**
* Enter description here...
*
* @param Doctrine_Entity $entity
* @override
*/
public function generate(Doctrine_Entity $entity)
{
$conn = $this->_em->getConnection();
$sql = $conn->getDatabasePlatform()->getSequenceNextValSql($this->_sequenceName);
return $conn->fetchOne($sql);
}
}
?>