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
fdd9b051
Commit
fdd9b051
authored
Nov 25, 2009
by
romanb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[2.0] Fix for optimistic locking.
parent
ba4d1bb3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
8 deletions
+7
-8
EntityManager.php
lib/Doctrine/ORM/EntityManager.php
+0
-1
Assigned.php
lib/Doctrine/ORM/Id/Assigned.php
+4
-4
StandardEntityPersister.php
lib/Doctrine/ORM/Persisters/StandardEntityPersister.php
+1
-1
AssignedIdTest.php
tests/Doctrine/Tests/ORM/Id/AssignedIdTest.php
+2
-2
No files found.
lib/Doctrine/ORM/EntityManager.php
View file @
fdd9b051
...
...
@@ -588,7 +588,6 @@ class EntityManager
*
* @param mixed $conn An array with the connection parameters or an existing
* Connection instance.
* @param string $name The name of the EntityManager.
* @param Configuration $config The Configuration instance to use.
* @param EventManager $eventManager The EventManager instance to use.
* @return EntityManager The created EntityManager.
...
...
lib/Doctrine/ORM/Id/Assigned.php
View file @
fdd9b051
...
...
@@ -49,16 +49,16 @@ class Assigned extends AbstractIdGenerator
foreach
(
$idFields
as
$idField
)
{
$value
=
$class
->
getReflectionProperty
(
$idField
)
->
getValue
(
$entity
);
if
(
isset
(
$value
))
{
$identifier
[]
=
$value
;
$identifier
[
$idField
]
=
$value
;
}
else
{
throw
ORMException
::
entityMissingAssignedId
(
$entity
);
}
}
}
else
{
$
value
=
$class
->
getReflectionProperty
(
$class
->
getSingleIdentifierFieldName
())
->
getValue
(
$entity
);
$
idField
=
$class
->
identifier
[
0
];
$value
=
$class
->
reflFields
[
$idField
]
->
getValue
(
$entity
);
if
(
isset
(
$value
))
{
$identifier
[]
=
$value
;
$identifier
[
$idField
]
=
$value
;
}
else
{
throw
ORMException
::
entityMissingAssignedId
(
$entity
);
}
...
...
lib/Doctrine/ORM/Persisters/StandardEntityPersister.php
View file @
fdd9b051
...
...
@@ -183,7 +183,7 @@ class StandardEntityPersister
//FIXME: Order with composite keys might not be correct
$sql
=
"SELECT "
.
$versionFieldColumnName
.
" FROM "
.
$class
->
getQuotedTableName
(
$this
->
_platform
)
.
" WHERE "
.
implode
(
' = ? AND '
,
$identifier
)
.
" = ?"
;
$value
=
$this
->
_conn
->
fetchColumn
(
$sql
,
array_values
(
$id
));
$value
=
$this
->
_conn
->
fetchColumn
(
$sql
,
array_values
(
(
array
)
$id
));
$this
->
_class
->
setFieldValue
(
$entity
,
$versionField
,
$value
);
}
...
...
tests/Doctrine/Tests/ORM/Id/AssignedIdTest.php
View file @
fdd9b051
...
...
@@ -42,13 +42,13 @@ class AssignedIdTest extends \Doctrine\Tests\OrmTestCase
$entity
=
new
AssignedSingleIdEntity
;
$entity
->
myId
=
1
;
$id
=
$this
->
_assignedGen
->
generate
(
$this
->
_em
,
$entity
);
$this
->
assertEquals
(
array
(
1
),
$id
);
$this
->
assertEquals
(
array
(
'myId'
=>
1
),
$id
);
$entity
=
new
AssignedCompositeIdEntity
;
$entity
->
myId2
=
2
;
$entity
->
myId1
=
4
;
$id
=
$this
->
_assignedGen
->
generate
(
$this
->
_em
,
$entity
);
$this
->
assertEquals
(
array
(
4
,
2
),
$id
);
$this
->
assertEquals
(
array
(
'myId1'
=>
4
,
'myId2'
=>
2
),
$id
);
}
}
...
...
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