Merge branch 'DDC-1984'
This commit is contained in:
commit
7d53cb2aeb
@ -2270,6 +2270,10 @@ class UnitOfWork implements PropertyChangedListener
|
||||
*/
|
||||
public function lock($entity, $lockMode, $lockVersion = null)
|
||||
{
|
||||
if ($entity === null) {
|
||||
throw new \InvalidArgumentException("No entity passed to UnitOfWork#lock().");
|
||||
}
|
||||
|
||||
if ($this->getEntityState($entity, self::STATE_DETACHED) != self::STATE_MANAGED) {
|
||||
throw ORMInvalidArgumentException::entityNotManaged($entity);
|
||||
}
|
||||
|
@ -220,6 +220,15 @@ class UnitOfWorkTest extends \Doctrine\Tests\OrmTestCase
|
||||
// This commit should not raise an E_NOTICE
|
||||
$this->_unitOfWork->commit();
|
||||
}
|
||||
|
||||
/**
|
||||
* @group DDC-1984
|
||||
*/
|
||||
public function testLockWithoutEntityThrowsException()
|
||||
{
|
||||
$this->setExpectedException('InvalidArgumentException');
|
||||
$this->_unitOfWork->lock(null, null, null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user