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
7f725aa7
Commit
7f725aa7
authored
Nov 07, 2009
by
romanb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[2.0][DDC-121] Fixed unintended collection initialization in UnitOfWork.
parent
3a59aefd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
2 deletions
+17
-2
UnitOfWork.php
lib/Doctrine/ORM/UnitOfWork.php
+17
-2
No files found.
lib/Doctrine/ORM/UnitOfWork.php
View file @
7f725aa7
...
@@ -1494,6 +1494,10 @@ class UnitOfWork implements PropertyChangedListener
...
@@ -1494,6 +1494,10 @@ class UnitOfWork implements PropertyChangedListener
}
}
$relatedEntities
=
$class
->
reflFields
[
$assocMapping
->
sourceFieldName
]
->
getValue
(
$entity
);
$relatedEntities
=
$class
->
reflFields
[
$assocMapping
->
sourceFieldName
]
->
getValue
(
$entity
);
if
(
$relatedEntities
instanceof
Collection
)
{
if
(
$relatedEntities
instanceof
Collection
)
{
if
(
$relatedEntities
instanceof
PersistentCollection
)
{
// Unwrap so that foreach() does not initialize
$relatedEntities
=
$relatedEntities
->
unwrap
();
}
foreach
(
$relatedEntities
as
$relatedEntity
)
{
foreach
(
$relatedEntities
as
$relatedEntity
)
{
$this
->
_doDetach
(
$relatedEntity
,
$visited
);
$this
->
_doDetach
(
$relatedEntity
,
$visited
);
}
}
...
@@ -1519,6 +1523,10 @@ class UnitOfWork implements PropertyChangedListener
...
@@ -1519,6 +1523,10 @@ class UnitOfWork implements PropertyChangedListener
}
}
$relatedEntities
=
$class
->
reflFields
[
$assocMapping
->
sourceFieldName
]
->
getValue
(
$entity
);
$relatedEntities
=
$class
->
reflFields
[
$assocMapping
->
sourceFieldName
]
->
getValue
(
$entity
);
if
(
$relatedEntities
instanceof
Collection
)
{
if
(
$relatedEntities
instanceof
Collection
)
{
if
(
$relatedEntities
instanceof
PersistentCollection
)
{
// Unwrap so that foreach() does not initialize
$relatedEntities
=
$relatedEntities
->
unwrap
();
}
foreach
(
$relatedEntities
as
$relatedEntity
)
{
foreach
(
$relatedEntities
as
$relatedEntity
)
{
$this
->
_doMerge
(
$relatedEntity
,
$visited
,
$managedCopy
,
$assocMapping
);
$this
->
_doMerge
(
$relatedEntity
,
$visited
,
$managedCopy
,
$assocMapping
);
}
}
...
@@ -1544,6 +1552,10 @@ class UnitOfWork implements PropertyChangedListener
...
@@ -1544,6 +1552,10 @@ class UnitOfWork implements PropertyChangedListener
}
}
$relatedEntities
=
$class
->
reflFields
[
$assocMapping
->
sourceFieldName
]
->
getValue
(
$entity
);
$relatedEntities
=
$class
->
reflFields
[
$assocMapping
->
sourceFieldName
]
->
getValue
(
$entity
);
if
((
$relatedEntities
instanceof
Collection
||
is_array
(
$relatedEntities
)))
{
if
((
$relatedEntities
instanceof
Collection
||
is_array
(
$relatedEntities
)))
{
if
(
$relatedEntities
instanceof
PersistentCollection
)
{
// Unwrap so that foreach() does not initialize
$relatedEntities
=
$relatedEntities
->
unwrap
();
}
foreach
(
$relatedEntities
as
$relatedEntity
)
{
foreach
(
$relatedEntities
as
$relatedEntity
)
{
$this
->
_doPersist
(
$relatedEntity
,
$visited
);
$this
->
_doPersist
(
$relatedEntity
,
$visited
);
}
}
...
@@ -1568,6 +1580,10 @@ class UnitOfWork implements PropertyChangedListener
...
@@ -1568,6 +1580,10 @@ class UnitOfWork implements PropertyChangedListener
}
}
$relatedEntities
=
$class
->
reflFields
[
$assocMapping
->
sourceFieldName
]
->
getValue
(
$entity
);
$relatedEntities
=
$class
->
reflFields
[
$assocMapping
->
sourceFieldName
]
->
getValue
(
$entity
);
if
(
$relatedEntities
instanceof
Collection
||
is_array
(
$relatedEntities
))
{
if
(
$relatedEntities
instanceof
Collection
||
is_array
(
$relatedEntities
))
{
if
(
$relatedEntities
instanceof
PersistentCollection
)
{
// Unwrap so that foreach() does not initialize
$relatedEntities
=
$relatedEntities
->
unwrap
();
}
foreach
(
$relatedEntities
as
$relatedEntity
)
{
foreach
(
$relatedEntities
as
$relatedEntity
)
{
$this
->
_doRemove
(
$relatedEntity
,
$visited
);
$this
->
_doRemove
(
$relatedEntity
,
$visited
);
}
}
...
@@ -1703,7 +1719,7 @@ class UnitOfWork implements PropertyChangedListener
...
@@ -1703,7 +1719,7 @@ class UnitOfWork implements PropertyChangedListener
}
}
$targetClass
=
$this
->
_em
->
getClassMetadata
(
$assoc
->
targetEntityName
);
$targetClass
=
$this
->
_em
->
getClassMetadata
(
$assoc
->
targetEntityName
);
if
(
$assoc
->
isOneToOne
())
{
if
(
$assoc
->
isOneToOne
())
{
if
(
$assoc
->
isOwningSide
)
{
if
(
$assoc
->
isOwningSide
)
{
$associatedId
=
array
();
$associatedId
=
array
();
...
@@ -1768,7 +1784,6 @@ class UnitOfWork implements PropertyChangedListener
...
@@ -1768,7 +1784,6 @@ class UnitOfWork implements PropertyChangedListener
if
(
$this
->
_evm
->
hasListeners
(
Events
::
postLoad
))
{
if
(
$this
->
_evm
->
hasListeners
(
Events
::
postLoad
))
{
$this
->
_evm
->
dispatchEvent
(
Events
::
postLoad
,
new
LifecycleEventArgs
(
$entity
));
$this
->
_evm
->
dispatchEvent
(
Events
::
postLoad
,
new
LifecycleEventArgs
(
$entity
));
}
}
return
$entity
;
return
$entity
;
}
}
...
...
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