Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
10312494
Commit
10312494
authored
May 15, 2010
by
Benjamin Eberlei
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'DDC-178' into develop
parents
e9583964
78328ec6
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
25 additions
and
21 deletions
+25
-21
EntityManager.php
lib/Doctrine/ORM/EntityManager.php
+1
-0
EntityRepository.php
lib/Doctrine/ORM/EntityRepository.php
+2
-0
BasicEntityPersister.php
lib/Doctrine/ORM/Persisters/BasicEntityPersister.php
+4
-4
Query.php
lib/Doctrine/ORM/Query.php
+3
-2
SqlWalker.php
lib/Doctrine/ORM/Query/SqlWalker.php
+3
-3
UnitOfWork.php
lib/Doctrine/ORM/UnitOfWork.php
+2
-2
EntityRepositoryTest.php
tests/Doctrine/Tests/ORM/Functional/EntityRepositoryTest.php
+4
-4
GearmanLockTest.php
...Doctrine/Tests/ORM/Functional/Locking/GearmanLockTest.php
+1
-1
LockTest.php
tests/Doctrine/Tests/ORM/Functional/Locking/LockTest.php
+1
-1
SelectSqlGenerationTest.php
tests/Doctrine/Tests/ORM/Query/SelectSqlGenerationTest.php
+4
-4
No files found.
lib/Doctrine/ORM/EntityManager.php
View file @
10312494
...
...
@@ -22,6 +22,7 @@ namespace Doctrine\ORM;
use
Closure
,
Exception
,
Doctrine\Common\EventManager
,
Doctrine\DBAL\Connection
,
Doctrine\DBAL\LockMode
,
Doctrine\ORM\Mapping\ClassMetadata
,
Doctrine\ORM\Mapping\ClassMetadataFactory
,
Doctrine\ORM\Proxy\ProxyFactory
;
...
...
lib/Doctrine/ORM/EntityRepository.php
View file @
10312494
...
...
@@ -19,6 +19,8 @@
namespace
Doctrine\ORM
;
use
Doctrine\DBAL\LockMode
;
/**
* An EntityRepository serves as a repository for entities with generic as well as
* business specific methods for retrieving entities.
...
...
lib/Doctrine/ORM/Persisters/BasicEntityPersister.php
View file @
10312494
...
...
@@ -790,9 +790,9 @@ class BasicEntityPersister
:
''
;
$lockSql
=
''
;
if
(
$lockMode
==
\Doctrine\
ORM
\LockMode
::
PESSIMISTIC_READ
)
{
if
(
$lockMode
==
\Doctrine\
DBAL
\LockMode
::
PESSIMISTIC_READ
)
{
$lockSql
=
' '
.
$this
->
_platform
->
getReadLockSql
();
}
else
if
(
$lockMode
==
\Doctrine\
ORM
\LockMode
::
PESSIMISTIC_WRITE
)
{
}
else
if
(
$lockMode
==
\Doctrine\
DBAL
\LockMode
::
PESSIMISTIC_WRITE
)
{
$lockSql
=
' '
.
$this
->
_platform
->
getWriteLockSql
();
}
...
...
@@ -1028,9 +1028,9 @@ class BasicEntityPersister
{
$conditionSql
=
$this
->
_getSelectConditionSQL
(
$criteria
);
if
(
$lockMode
==
\Doctrine\
ORM
\LockMode
::
PESSIMISTIC_READ
)
{
if
(
$lockMode
==
\Doctrine\
DBAL
\LockMode
::
PESSIMISTIC_READ
)
{
$lockSql
=
$this
->
_platform
->
getReadLockSql
();
}
else
if
(
$lockMode
==
\Doctrine\
ORM
\LockMode
::
PESSIMISTIC_WRITE
)
{
}
else
if
(
$lockMode
==
\Doctrine\
DBAL
\LockMode
::
PESSIMISTIC_WRITE
)
{
$lockSql
=
$this
->
_platform
->
getWriteLockSql
();
}
...
...
lib/Doctrine/ORM/Query.php
View file @
10312494
...
...
@@ -19,7 +19,8 @@
namespace
Doctrine\ORM
;
use
Doctrine\ORM\Query\Parser
,
use
Doctrine\DBAL\LockMode
,
Doctrine\ORM\Query\Parser
,
Doctrine\ORM\Query\QueryException
;
/**
...
...
@@ -495,7 +496,7 @@ final class Query extends AbstractQuery
/**
* Set the lock mode for this Query.
*
* @see Doctrine\
ORM
\LockMode
* @see Doctrine\
DBAL
\LockMode
* @param int $lockMode
* @return Query
*/
...
...
lib/Doctrine/ORM/Query/SqlWalker.php
View file @
10312494
...
...
@@ -367,11 +367,11 @@ class SqlWalker implements TreeWalker
);
if
((
$lockMode
=
$this
->
_query
->
getHint
(
Query
::
HINT_LOCK_MODE
))
!==
false
)
{
if
(
$lockMode
==
\Doctrine\
ORM
\LockMode
::
PESSIMISTIC_READ
)
{
if
(
$lockMode
==
\Doctrine\
DBAL
\LockMode
::
PESSIMISTIC_READ
)
{
$sql
.=
" "
.
$this
->
_platform
->
getReadLockSQL
();
}
else
if
(
$lockMode
==
\Doctrine\
ORM
\LockMode
::
PESSIMISTIC_WRITE
)
{
}
else
if
(
$lockMode
==
\Doctrine\
DBAL
\LockMode
::
PESSIMISTIC_WRITE
)
{
$sql
.=
" "
.
$this
->
_platform
->
getWriteLockSQL
();
}
else
if
(
$lockMode
==
\Doctrine\
ORM
\LockMode
::
OPTIMISTIC
)
{
}
else
if
(
$lockMode
==
\Doctrine\
DBAL
\LockMode
::
OPTIMISTIC
)
{
$versionedClassFound
=
false
;
foreach
(
$this
->
_selectedClasses
AS
$class
)
{
if
(
$class
->
isVersioned
)
{
...
...
lib/Doctrine/ORM/UnitOfWork.php
View file @
10312494
...
...
@@ -1646,7 +1646,7 @@ class UnitOfWork implements PropertyChangedListener
$entityName
=
get_class
(
$entity
);
$class
=
$this
->
_em
->
getClassMetadata
(
$entityName
);
if
(
$lockMode
==
LockMode
::
OPTIMISTIC
)
{
if
(
$lockMode
==
\Doctrine\DBAL\
LockMode
::
OPTIMISTIC
)
{
if
(
!
$class
->
isVersioned
)
{
throw
OptimisticLockException
::
notVersioned
(
$entityName
);
}
...
...
@@ -1657,7 +1657,7 @@ class UnitOfWork implements PropertyChangedListener
throw
OptimisticLockException
::
lockFailedVersionMissmatch
(
$entity
,
$lockVersion
,
$entityVersion
);
}
}
}
else
if
(
$lockMode
==
LockMode
::
PESSIMISTIC_READ
||
$lockMode
==
LockMode
::
PESSIMISTIC_WRITE
)
{
}
else
if
(
in_array
(
$lockMode
,
array
(
\Doctrine\DBAL\LockMode
::
PESSIMISTIC_READ
,
\Doctrine\DBAL\LockMode
::
PESSIMISTIC_WRITE
))
)
{
if
(
!
$this
->
_em
->
getConnection
()
->
isTransactionActive
())
{
throw
TransactionRequiredException
::
transactionRequired
();
...
...
tests/Doctrine/Tests/ORM/Functional/EntityRepositoryTest.php
View file @
10312494
...
...
@@ -103,7 +103,7 @@ class EntityRepositoryTest extends \Doctrine\Tests\OrmFunctionalTestCase
$this
->
setExpectedException
(
'Doctrine\ORM\TransactionRequiredException'
);
$this
->
_em
->
getRepository
(
'Doctrine\Tests\Models\CMS\CmsUser'
)
->
find
(
1
,
\Doctrine\
ORM
\LockMode
::
PESSIMISTIC_READ
);
->
find
(
1
,
\Doctrine\
DBAL
\LockMode
::
PESSIMISTIC_READ
);
}
/**
...
...
@@ -115,7 +115,7 @@ class EntityRepositoryTest extends \Doctrine\Tests\OrmFunctionalTestCase
$this
->
setExpectedException
(
'Doctrine\ORM\TransactionRequiredException'
);
$this
->
_em
->
getRepository
(
'Doctrine\Tests\Models\CMS\CmsUser'
)
->
find
(
1
,
\Doctrine\
ORM
\LockMode
::
PESSIMISTIC_WRITE
);
->
find
(
1
,
\Doctrine\
DBAL
\LockMode
::
PESSIMISTIC_WRITE
);
}
/**
...
...
@@ -127,7 +127,7 @@ class EntityRepositoryTest extends \Doctrine\Tests\OrmFunctionalTestCase
$this
->
setExpectedException
(
'Doctrine\ORM\OptimisticLockException'
);
$this
->
_em
->
getRepository
(
'Doctrine\Tests\Models\CMS\CmsUser'
)
->
find
(
1
,
\Doctrine\
ORM
\LockMode
::
OPTIMISTIC
);
->
find
(
1
,
\Doctrine\
DBAL
\LockMode
::
OPTIMISTIC
);
}
/**
...
...
@@ -148,7 +148,7 @@ class EntityRepositoryTest extends \Doctrine\Tests\OrmFunctionalTestCase
$this
->
_em
->
find
(
'Doctrine\Tests\Models\Cms\CmsUser'
,
$userId
);
$this
->
setExpectedException
(
'Doctrine\ORM\OptimisticLockException'
);
$this
->
_em
->
find
(
'Doctrine\Tests\Models\Cms\CmsUser'
,
$userId
,
\Doctrine\
ORM
\LockMode
::
OPTIMISTIC
);
$this
->
_em
->
find
(
'Doctrine\Tests\Models\Cms\CmsUser'
,
$userId
,
\Doctrine\
DBAL
\LockMode
::
OPTIMISTIC
);
}
}
tests/Doctrine/Tests/ORM/Functional/Locking/GearmanLockTest.php
View file @
10312494
...
...
@@ -4,7 +4,7 @@ namespace Doctrine\Tests\ORM\Functional\Locking;
use
Doctrine\Tests\Models\CMS\CmsArticle
,
Doctrine\Tests\Models\CMS\CmsUser
,
Doctrine\
ORM
\LockMode
,
Doctrine\
DBAL
\LockMode
,
Doctrine\ORM\EntityManager
;
require_once
__DIR__
.
'/../../../TestInit.php'
;
...
...
tests/Doctrine/Tests/ORM/Functional/Locking/LockTest.php
View file @
10312494
...
...
@@ -4,7 +4,7 @@ namespace Doctrine\Tests\ORM\Functional\Locking;
use
Doctrine\Tests\Models\CMS\CmsArticle
,
Doctrine\Tests\Models\CMS\CmsUser
,
Doctrine\
ORM
\LockMode
,
Doctrine\
DBAL
\LockMode
,
Doctrine\ORM\EntityManager
;
require_once
__DIR__
.
'/../../../TestInit.php'
;
...
...
tests/Doctrine/Tests/ORM/Query/SelectSqlGenerationTest.php
View file @
10312494
...
...
@@ -603,7 +603,7 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase
"SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.username = 'gblanco'"
,
"SELECT c0_.id AS id0, c0_.status AS status1, c0_.username AS username2, c0_.name AS name3 "
.
"FROM cms_users c0_ WHERE c0_.username = 'gblanco' FOR UPDATE"
,
array
(
Query
::
HINT_LOCK_MODE
=>
\Doctrine\
ORM
\LockMode
::
PESSIMISTIC_WRITE
)
array
(
Query
::
HINT_LOCK_MODE
=>
\Doctrine\
DBAL
\LockMode
::
PESSIMISTIC_WRITE
)
);
}
...
...
@@ -619,7 +619,7 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase
"SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.username = 'gblanco'"
,
"SELECT c0_.id AS id0, c0_.status AS status1, c0_.username AS username2, c0_.name AS name3 "
.
"FROM cms_users c0_ WHERE c0_.username = 'gblanco' FOR SHARE"
,
array
(
Query
::
HINT_LOCK_MODE
=>
\Doctrine\
ORM
\LockMode
::
PESSIMISTIC_READ
)
array
(
Query
::
HINT_LOCK_MODE
=>
\Doctrine\
DBAL
\LockMode
::
PESSIMISTIC_READ
)
);
}
...
...
@@ -646,7 +646,7 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase
"SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.username = 'gblanco'"
,
"SELECT c0_.id AS id0, c0_.status AS status1, c0_.username AS username2, c0_.name AS name3 "
.
"FROM cms_users c0_ WHERE c0_.username = 'gblanco' LOCK IN SHARE MODE"
,
array
(
Query
::
HINT_LOCK_MODE
=>
\Doctrine\
ORM
\LockMode
::
PESSIMISTIC_READ
)
array
(
Query
::
HINT_LOCK_MODE
=>
\Doctrine\
DBAL
\LockMode
::
PESSIMISTIC_READ
)
);
}
...
...
@@ -662,7 +662,7 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase
"SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.username = 'gblanco'"
,
"SELECT c0_.id AS id0, c0_.status AS status1, c0_.username AS username2, c0_.name AS name3 "
.
"FROM cms_users c0_ WHERE c0_.username = 'gblanco' FOR UPDATE"
,
array
(
Query
::
HINT_LOCK_MODE
=>
\Doctrine\
ORM
\LockMode
::
PESSIMISTIC_READ
)
array
(
Query
::
HINT_LOCK_MODE
=>
\Doctrine\
DBAL
\LockMode
::
PESSIMISTIC_READ
)
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment