1
0
mirror of synced 2024-12-15 23:56:02 +03:00
doctrine2/lib/Doctrine/ORM/Id/SequenceIdentityGenerator.php

29 lines
548 B
PHP
Raw Normal View History

2008-09-07 17:48:40 +04:00
<?php
namespace Doctrine\ORM\Id;
use Doctrine\ORM\EntityManager;
class SequenceIdentityGenerator extends IdentityGenerator
2008-09-07 17:48:40 +04:00
{
private $_sequenceName;
public function __construct($sequenceName)
{
$this->_sequenceName = $sequenceName;
}
public function generate(EntityManager $em, $entity)
{
return $em->getConnection()->lastInsertId($this->_sequenceName);
}
2008-09-07 17:48:40 +04:00
/**
* @return boolean
2008-09-07 17:48:40 +04:00
* @override
*/
public function isPostInsertGenerator()
2008-09-07 17:48:40 +04:00
{
return true;
2008-09-07 17:48:40 +04:00
}
}