Reverting BC break in AbstractIdGenerator signature
This commit is contained in:
parent
de589799e8
commit
f799986be1
@ -19,19 +19,18 @@
|
||||
|
||||
namespace Doctrine\ORM\Id;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
|
||||
abstract class AbstractIdGenerator
|
||||
{
|
||||
/**
|
||||
* Generates an identifier for an entity.
|
||||
*
|
||||
* @param EntityManagerInterface $em
|
||||
* @param EntityManager|EntityManager $em
|
||||
* @param \Doctrine\ORM\Mapping\Entity $entity
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
abstract public function generate(EntityManagerInterface $em, $entity);
|
||||
abstract public function generate(EntityManager $em, $entity);
|
||||
|
||||
/**
|
||||
* Gets whether this generator is a post-insert generator which means that
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
namespace Doctrine\ORM\Id;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\ORMException;
|
||||
|
||||
/**
|
||||
@ -40,7 +40,8 @@ class AssignedGenerator extends AbstractIdGenerator
|
||||
*
|
||||
* @throws \Doctrine\ORM\ORMException
|
||||
*/
|
||||
public function generate(EntityManagerInterface $em, $entity)
|
||||
public function generate(
|
||||
EntityManager $em, $entity)
|
||||
{
|
||||
$class = $em->getClassMetadata(get_class($entity));
|
||||
$idFields = $class->getIdentifierFieldNames();
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
namespace Doctrine\ORM\Id;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
|
||||
/**
|
||||
* Id generator that obtains IDs from special "identity" columns. These are columns
|
||||
@ -50,7 +50,7 @@ class BigIntegerIdentityGenerator extends AbstractIdGenerator
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function generate(EntityManagerInterface $em, $entity)
|
||||
public function generate(EntityManager $em, $entity)
|
||||
{
|
||||
return (string) $em->getConnection()->lastInsertId($this->sequenceName);
|
||||
}
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
namespace Doctrine\ORM\Id;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
|
||||
/**
|
||||
* Id generator that obtains IDs from special "identity" columns. These are columns
|
||||
@ -50,7 +50,8 @@ class IdentityGenerator extends AbstractIdGenerator
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function generate(EntityManagerInterface $em, $entity)
|
||||
public function generate(
|
||||
EntityManager $em, $entity)
|
||||
{
|
||||
return (int)$em->getConnection()->lastInsertId($this->sequenceName);
|
||||
}
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
namespace Doctrine\ORM\Id;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Serializable;
|
||||
|
||||
/**
|
||||
@ -69,7 +69,7 @@ class SequenceGenerator extends AbstractIdGenerator implements Serializable
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function generate(EntityManagerInterface $em, $entity)
|
||||
public function generate(EntityManager $em, $entity)
|
||||
{
|
||||
if ($this->_maxValue === null || $this->_nextValue == $this->_maxValue) {
|
||||
// Allocate new values
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
namespace Doctrine\ORM\Id;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
|
||||
/**
|
||||
* Id generator that uses a single-row database table and a hi/lo algorithm.
|
||||
@ -72,7 +72,8 @@ class TableGenerator extends AbstractIdGenerator
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function generate(EntityManagerInterface $em, $entity)
|
||||
public function generate(
|
||||
EntityManager $em, $entity)
|
||||
{
|
||||
if ($this->_maxValue === null || $this->_nextValue == $this->_maxValue) {
|
||||
// Allocate new values
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
namespace Doctrine\ORM\Id;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
|
||||
/**
|
||||
* Represents an ID generator that uses the database UUID expression
|
||||
@ -32,7 +32,7 @@ class UuidGenerator extends AbstractIdGenerator
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function generate(EntityManagerInterface $em, $entity)
|
||||
public function generate(EntityManager $em, $entity)
|
||||
{
|
||||
$conn = $em->getConnection();
|
||||
$sql = 'SELECT ' . $conn->getDatabasePlatform()->getGuidExpression();
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
namespace Doctrine\Tests\Mocks;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
|
||||
/**
|
||||
* Mock class for SequenceGenerator.
|
||||
@ -17,7 +17,7 @@ class SequenceMock extends \Doctrine\ORM\Id\SequenceGenerator
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function generate(EntityManagerInterface $em, $entity)
|
||||
public function generate(EntityManager $em, $entity)
|
||||
{
|
||||
return $this->_sequenceNumber++;
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
namespace Doctrine\Tests\ORM\Functional\Ticket;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\Id\AbstractIdGenerator;
|
||||
use Doctrine\ORM\Mapping\ClassMetadataInfo;
|
||||
use Doctrine\ORM\Mapping\Driver\StaticPHPDriver;
|
||||
@ -97,7 +97,7 @@ class DDC2415ChildEntity extends DDC2415ParentEntity
|
||||
|
||||
class DDC2415Generator extends AbstractIdGenerator
|
||||
{
|
||||
public function generate(EntityManagerInterface $em, $entity)
|
||||
public function generate(EntityManager $em, $entity)
|
||||
{
|
||||
return md5($entity->getName());
|
||||
}
|
||||
|
@ -2,17 +2,17 @@
|
||||
|
||||
namespace Doctrine\Tests\ORM\Mapping;
|
||||
|
||||
use Doctrine\Common\EventManager;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\Event\OnClassMetadataNotFoundEventArgs;
|
||||
use Doctrine\ORM\Events;
|
||||
use Doctrine\Tests\Mocks\MetadataDriverMock;
|
||||
use Doctrine\Tests\Mocks\EntityManagerMock;
|
||||
use Doctrine\ORM\Id\AbstractIdGenerator;
|
||||
use Doctrine\ORM\Mapping\ClassMetadata;
|
||||
use Doctrine\ORM\Mapping\ClassMetadataFactory;
|
||||
use Doctrine\Tests\Mocks\ConnectionMock;
|
||||
use Doctrine\Tests\Mocks\DriverMock;
|
||||
use Doctrine\ORM\Mapping\ClassMetadata;
|
||||
use Doctrine\Common\EventManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\Id\AbstractIdGenerator;
|
||||
use Doctrine\ORM\Mapping\ClassMetadataFactory;
|
||||
use Doctrine\Tests\Mocks\EntityManagerMock;
|
||||
use Doctrine\Tests\Mocks\MetadataDriverMock;
|
||||
|
||||
class ClassMetadataFactoryTest extends \Doctrine\Tests\OrmTestCase
|
||||
{
|
||||
@ -367,7 +367,7 @@ class ClassMetadataFactoryTest extends \Doctrine\Tests\OrmTestCase
|
||||
{
|
||||
$classMetadataFactory = new ClassMetadataFactory();
|
||||
|
||||
/* @var $entityManager \Doctrine\ORM\EntityManager */
|
||||
/* @var $entityManager EntityManager */
|
||||
$entityManager = $this->getMock('Doctrine\\ORM\\EntityManagerInterface');
|
||||
|
||||
$classMetadataFactory->setEntityManager($entityManager);
|
||||
@ -414,7 +414,7 @@ class TestEntity1
|
||||
|
||||
class CustomIdGenerator extends AbstractIdGenerator
|
||||
{
|
||||
public function generate(EntityManagerInterface $em, $entity)
|
||||
public function generate(EntityManager $em, $entity)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user