1
0
mirror of synced 2024-12-15 15:46:02 +03:00
doctrine2/tests/lib/mocks/Doctrine_SequenceMock.php

57 lines
961 B
PHP
Raw Normal View History

<?php
2008-09-12 14:02:06 +04:00
class Doctrine_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
*/
2008-09-12 14:40:23 +04:00
public function generate(Doctrine_ORM_Entity $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++;
}
}
?>