2008-08-31 22:27:16 +04:00
|
|
|
<?php
|
|
|
|
|
2008-09-12 14:02:06 +04:00
|
|
|
class Doctrine_ORM_Id_SequenceGenerator extends Doctrine_ORM_Id_AbstractIdGenerator
|
2008-09-07 17:48:40 +04:00
|
|
|
{
|
|
|
|
private $_sequenceName;
|
|
|
|
|
|
|
|
public function __construct($sequenceName)
|
|
|
|
{
|
|
|
|
$this->_sequenceName = $sequenceName;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Enter description here...
|
|
|
|
*
|
2008-09-12 14:40:23 +04:00
|
|
|
* @param Doctrine_ORM_Entity $entity
|
2008-09-07 17:48:40 +04:00
|
|
|
* @override
|
|
|
|
*/
|
2008-12-18 17:08:11 +03:00
|
|
|
public function generate($entity)
|
2008-09-07 17:48:40 +04:00
|
|
|
{
|
|
|
|
$conn = $this->_em->getConnection();
|
|
|
|
$sql = $conn->getDatabasePlatform()->getSequenceNextValSql($this->_sequenceName);
|
|
|
|
return $conn->fetchOne($sql);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-08-31 22:27:16 +04:00
|
|
|
?>
|