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
da582e11
Commit
da582e11
authored
Feb 14, 2010
by
romanb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[2.0] Fixed hardcoded version field access in optimistic locking.
parent
6356886c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
3 deletions
+5
-3
StandardEntityPersister.php
lib/Doctrine/ORM/Persisters/StandardEntityPersister.php
+1
-1
OptimisticTest.php
.../Doctrine/Tests/ORM/Functional/Locking/OptimisticTest.php
+4
-2
No files found.
lib/Doctrine/ORM/Persisters/StandardEntityPersister.php
View file @
da582e11
...
...
@@ -253,7 +253,7 @@ class StandardEntityPersister
$versionField
=
$this
->
_class
->
versionField
;
$versionFieldType
=
$this
->
_class
->
getTypeOfField
(
$versionField
);
$where
[
$versionField
]
=
Type
::
getType
(
$versionFieldType
)
->
convertToDatabaseValue
(
$
entity
->
version
,
$this
->
_platform
);
->
convertToDatabaseValue
(
$
this
->
_class
->
reflFields
[
$versionField
]
->
getValue
(
$entity
)
,
$this
->
_platform
);
$versionFieldColumnName
=
$this
->
_class
->
getQuotedColumnName
(
$versionField
,
$this
->
_platform
);
if
(
$versionFieldType
==
'integer'
)
{
$set
[]
=
$versionFieldColumnName
.
' = '
.
$versionFieldColumnName
.
' + 1'
;
...
...
tests/Doctrine/Tests/ORM/Functional/Locking/OptimisticTest.php
View file @
da582e11
...
...
@@ -94,7 +94,7 @@ class OptimisticTest extends \Doctrine\Tests\OrmFunctionalTestCase
$this
->
_em
->
persist
(
$test
);
$this
->
_em
->
flush
();
$this
->
assertEquals
(
1
,
$test
->
version
);
$this
->
assertEquals
(
1
,
$test
->
getVersion
()
);
}
/**
...
...
@@ -205,7 +205,9 @@ class OptimisticStandard
/**
* @Version @Column(type="integer")
*/
public
$version
;
private
$version
;
function
getVersion
()
{
return
$this
->
version
;}
}
/**
...
...
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