2008-07-21 00:13:24 +04:00
|
|
|
<?php
|
|
|
|
|
2009-01-22 22:38:10 +03:00
|
|
|
namespace Doctrine\Tests\Mocks;
|
2009-01-04 19:15:32 +03:00
|
|
|
|
2009-03-30 23:43:05 +04:00
|
|
|
use Doctrine\ORM\EntityManager;
|
|
|
|
|
2012-12-14 22:55:28 +04:00
|
|
|
/**
|
|
|
|
* Mock class for SequenceGenerator.
|
|
|
|
*/
|
2009-01-22 22:38:10 +03:00
|
|
|
class SequenceMock extends \Doctrine\ORM\Id\SequenceGenerator
|
2008-07-21 00:13:24 +04:00
|
|
|
{
|
2012-12-14 22:55:28 +04:00
|
|
|
/**
|
|
|
|
* @var int
|
|
|
|
*/
|
2008-07-21 00:13:24 +04:00
|
|
|
private $_sequenceNumber = 0;
|
2009-05-29 01:34:35 +04:00
|
|
|
|
2012-12-14 22:55:28 +04:00
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*/
|
2009-03-30 23:43:05 +04:00
|
|
|
public function generate(EntityManager $em, $entity)
|
2008-09-07 17:48:40 +04:00
|
|
|
{
|
|
|
|
return $this->_sequenceNumber++;
|
|
|
|
}
|
2009-05-29 01:34:35 +04:00
|
|
|
|
2008-08-01 22:46:14 +04:00
|
|
|
/* Mock API */
|
2009-05-29 01:34:35 +04:00
|
|
|
|
2012-12-14 22:55:28 +04:00
|
|
|
/**
|
|
|
|
* @return void
|
|
|
|
*/
|
2008-07-21 00:13:24 +04:00
|
|
|
public function reset()
|
|
|
|
{
|
|
|
|
$this->_sequenceNumber = 0;
|
|
|
|
}
|
|
|
|
}
|