1
0
mirror of synced 2024-12-14 07:06:04 +03:00
doctrine2/lib/Doctrine/ORM/Id/SequenceGenerator.php
2008-09-12 10:02:06 +00:00

26 lines
591 B
PHP

<?php
class Doctrine_ORM_Id_SequenceGenerator extends Doctrine_ORM_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);
}
}
?>