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
2209c5ef
Commit
2209c5ef
authored
Mar 20, 2010
by
romanb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[2.0][DDC-444] Fixed.
parent
f34a99cc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
81 additions
and
3 deletions
+81
-3
UnitOfWork.php
lib/Doctrine/ORM/UnitOfWork.php
+5
-3
DDC444Test.php
tests/Doctrine/Tests/ORM/Functional/Ticket/DDC444Test.php
+76
-0
No files found.
lib/Doctrine/ORM/UnitOfWork.php
View file @
2209c5ef
...
...
@@ -519,9 +519,11 @@ class UnitOfWork implements PropertyChangedListener
continue
;
}
// If change tracking is explicit, then only compute changes on explicitly
sav
ed entities
// If change tracking is explicit, then only compute changes on explicitly
persist
ed entities
$entitiesToProcess
=
$class
->
isChangeTrackingDeferredExplicit
()
?
$this
->
_scheduledForDirtyCheck
[
$className
]
:
$entities
;
(
isset
(
$this
->
_scheduledForDirtyCheck
[
$className
])
?
$this
->
_scheduledForDirtyCheck
[
$className
]
:
array
())
:
$entities
;
foreach
(
$entitiesToProcess
as
$entity
)
{
// Ignore uninitialized proxy objects
...
...
@@ -1927,7 +1929,7 @@ class UnitOfWork implements PropertyChangedListener
public
function
scheduleForDirtyCheck
(
$entity
)
{
$rootClassName
=
$this
->
_em
->
getClassMetadata
(
get_class
(
$entity
))
->
rootEntityName
;
$this
->
_scheduledForDirtyCheck
[
$rootClassName
]
=
$entity
;
$this
->
_scheduledForDirtyCheck
[
$rootClassName
]
[]
=
$entity
;
}
/**
...
...
tests/Doctrine/Tests/ORM/Functional/Ticket/DDC444Test.php
0 → 100644
View file @
2209c5ef
<?php
namespace
Doctrine\Tests\ORM\Functional\Ticket
;
require_once
__DIR__
.
'/../../../TestInit.php'
;
class
DDC444Test
extends
\Doctrine\Tests\OrmFunctionalTestCase
{
public
function
setUp
()
{
parent
::
setUp
();
$this
->
_schemaTool
->
createSchema
(
array
(
$this
->
_em
->
getClassMetadata
(
__NAMESPACE__
.
'\DDC444User'
),
));
}
public
function
testExplicitPolicy
()
{
$classname
=
__NAMESPACE__
.
"\DDC444User"
;
$u
=
new
$classname
;
$u
->
name
=
"Initial value"
;
$this
->
_em
->
persist
(
$u
);
$this
->
_em
->
flush
();
$this
->
_em
->
clear
();
$q
=
$this
->
_em
->
createQuery
(
"SELECT u FROM
$classname
u"
);
$u
=
$q
->
getSingleResult
();
$this
->
assertEquals
(
"Initial value"
,
$u
->
name
);
$u
->
name
=
"Modified value"
;
// This should be NOOP as the change hasn't been persisted
$this
->
_em
->
flush
();
$this
->
_em
->
clear
();
$u
=
$this
->
_em
->
createQuery
(
"SELECT u FROM
$classname
u"
);
$u
=
$q
->
getSingleResult
();
$this
->
assertEquals
(
"Initial value"
,
$u
->
name
);
$u
->
name
=
"Modified value"
;
$this
->
_em
->
persist
(
$u
);
// Now we however persisted it, and this should have updated our friend
$this
->
_em
->
flush
();
$q
=
$this
->
_em
->
createQuery
(
"SELECT u FROM
$classname
u"
);
$u
=
$q
->
getSingleResult
();
$this
->
assertEquals
(
"Modified value"
,
$u
->
name
);
}
}
/**
* @Entity @Table(name="ddc444")
* @ChangeTrackingPolicy("DEFERRED_EXPLICIT")
*/
class
DDC444User
{
/**
* @Id @Column(name="id", type="integer")
* @GeneratedValue(strategy="AUTO")
*/
public
$id
;
/**
* @Column(name="name", type="string")
*/
public
$name
;
}
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