1
0
mirror of synced 2024-12-13 22:56:04 +03:00
doctrine2/tests/Doctrine/Tests/Mocks/SequenceMock.php

57 lines
954 B
PHP
Raw Normal View History

<?php
namespace Doctrine\Tests\Mocks;
2009-01-04 19:15:32 +03:00
class SequenceMock extends \Doctrine\ORM\Id\SequenceGenerator
{
private $_sequenceNumber = 0;
2008-09-07 17:48:40 +04:00
/**
* Enter description here...
*
* @param Doctrine_Entity $entity
* @override
*/
public function generate($entity)
2008-09-07 17:48:40 +04:00
{
return $this->_sequenceNumber++;
}
/**
* @override
*/
public function nextId($seqName, $ondemand = true)
{
return $this->_sequenceNumber++;
}
/**
* @override
*/
public function lastInsertId($table = null, $field = null)
{
return $this->_sequenceNumber - 1;
}
/**
* @override
*/
public function currId($seqName)
{
return $this->_sequenceNumber;
}
/* Mock API */
public function reset()
{
$this->_sequenceNumber = 0;
}
public function autoinc()
{
$this->_sequenceNumber++;
}
}