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
080f7373
Commit
080f7373
authored
May 01, 2010
by
Roman S. Borschel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[DDC-534] Fixed.
parent
39a6c019
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
2 deletions
+18
-2
UnitOfWork.php
lib/Doctrine/ORM/UnitOfWork.php
+8
-2
UnitOfWorkTest.php
tests/Doctrine/Tests/ORM/UnitOfWorkTest.php
+10
-0
No files found.
lib/Doctrine/ORM/UnitOfWork.php
View file @
080f7373
...
@@ -485,7 +485,7 @@ class UnitOfWork implements PropertyChangedListener
...
@@ -485,7 +485,7 @@ class UnitOfWork implements PropertyChangedListener
}
}
}
}
}
}
// Look for changes in associations of the entity
// Look for changes in associations of the entity
foreach
(
$class
->
associationMappings
as
$assoc
)
{
foreach
(
$class
->
associationMappings
as
$assoc
)
{
$val
=
$class
->
reflFields
[
$assoc
->
sourceFieldName
]
->
getValue
(
$entity
);
$val
=
$class
->
reflFields
[
$assoc
->
sourceFieldName
]
->
getValue
(
$entity
);
...
@@ -2042,9 +2042,15 @@ class UnitOfWork implements PropertyChangedListener
...
@@ -2042,9 +2042,15 @@ class UnitOfWork implements PropertyChangedListener
$oid
=
spl_object_hash
(
$entity
);
$oid
=
spl_object_hash
(
$entity
);
$class
=
$this
->
_em
->
getClassMetadata
(
get_class
(
$entity
));
$class
=
$this
->
_em
->
getClassMetadata
(
get_class
(
$entity
));
$isAssocField
=
isset
(
$class
->
associationMappings
[
$propertyName
]);
if
(
!
$isAssocField
&&
!
isset
(
$class
->
fieldMappings
[
$propertyName
]))
{
return
;
// ignore non-persistent fields
}
$this
->
_entityChangeSets
[
$oid
][
$propertyName
]
=
array
(
$oldValue
,
$newValue
);
$this
->
_entityChangeSets
[
$oid
][
$propertyName
]
=
array
(
$oldValue
,
$newValue
);
if
(
isset
(
$class
->
associationMappings
[
$propertyName
])
)
{
if
(
$isAssocField
)
{
$assoc
=
$class
->
associationMappings
[
$propertyName
];
$assoc
=
$class
->
associationMappings
[
$propertyName
];
if
(
$assoc
->
isOneToOne
()
&&
$assoc
->
isOwningSide
)
{
if
(
$assoc
->
isOneToOne
()
&&
$assoc
->
isOwningSide
)
{
$this
->
_entityUpdates
[
$oid
]
=
$entity
;
$this
->
_entityUpdates
[
$oid
]
=
$entity
;
...
...
tests/Doctrine/Tests/ORM/UnitOfWorkTest.php
View file @
080f7373
...
@@ -140,6 +140,7 @@ class UnitOfWorkTest extends \Doctrine\Tests\OrmTestCase
...
@@ -140,6 +140,7 @@ class UnitOfWorkTest extends \Doctrine\Tests\OrmTestCase
$this
->
assertTrue
(
$this
->
_unitOfWork
->
isInIdentityMap
(
$entity
));
$this
->
assertTrue
(
$this
->
_unitOfWork
->
isInIdentityMap
(
$entity
));
$entity
->
setData
(
'newdata'
);
$entity
->
setData
(
'newdata'
);
$entity
->
setTransient
(
'newtransientvalue'
);
$this
->
assertTrue
(
$this
->
_unitOfWork
->
isScheduledForUpdate
(
$entity
));
$this
->
assertTrue
(
$this
->
_unitOfWork
->
isScheduledForUpdate
(
$entity
));
...
@@ -206,10 +207,19 @@ class NotifyChangedEntity implements \Doctrine\Common\NotifyPropertyChanged
...
@@ -206,10 +207,19 @@ class NotifyChangedEntity implements \Doctrine\Common\NotifyPropertyChanged
*/
*/
private
$data
;
private
$data
;
private
$transient
;
// not persisted
public
function
getId
()
{
public
function
getId
()
{
return
$this
->
id
;
return
$this
->
id
;
}
}
public
function
setTransient
(
$value
)
{
if
(
$value
!=
$this
->
transient
)
{
$this
->
_onPropertyChanged
(
'transient'
,
$this
->
transient
,
$value
);
$this
->
transient
=
$value
;
}
}
public
function
getData
()
{
public
function
getData
()
{
return
$this
->
data
;
return
$this
->
data
;
}
}
...
...
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