1
0
mirror of synced 2025-02-20 14:13:15 +03:00

[DDC-1612] Fix bug with EntityManager#flush($entity) on new entities.

This commit is contained in:
Benjamin Eberlei 2012-01-21 13:06:30 +01:00
parent 1d6a21f7fa
commit 6c24251452
2 changed files with 16 additions and 1 deletions

View File

@ -390,7 +390,7 @@ class UnitOfWork implements PropertyChangedListener
*/
private function computeSingleEntityChangeSet($entity)
{
if ( ! $this->isInIdentityMap($entity) ) {
if ( $this->getEntityState($entity) !== self::STATE_MANAGED) {
throw new \InvalidArgumentException("Entity has to be managed for single computation " . self::objToStr($entity));
}

View File

@ -1141,6 +1141,21 @@ class BasicFunctionalTest extends \Doctrine\Tests\OrmFunctionalTestCase
$this->_em->flush($user);
}
/**
* @group DDC-720
* @group DDC-1612
*/
public function testFlushSingleNewEntity()
{
$user = new CmsUser;
$user->name = 'Dominik';
$user->username = 'domnikl';
$user->status = 'developer';
$this->_em->persist($user);
$this->_em->flush($user);
}
/**
* @group DDC-720
*/