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
0c8a35f7
Commit
0c8a35f7
authored
Jul 15, 2009
by
romanb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[2.0] Cosmetics.
parent
311cff87
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
23 deletions
+28
-23
ObjectHydrator.php
lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php
+3
-6
StandardEntityPersister.php
lib/Doctrine/ORM/Persisters/StandardEntityPersister.php
+6
-4
UnitOfWork.php
lib/Doctrine/ORM/UnitOfWork.php
+7
-1
HydrationPerformanceTest.php
...ctrine/Tests/ORM/Performance/HydrationPerformanceTest.php
+12
-12
No files found.
lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php
View file @
0c8a35f7
...
@@ -350,6 +350,7 @@ class ObjectHydrator extends AbstractHydrator
...
@@ -350,6 +350,7 @@ class ObjectHydrator extends AbstractHydrator
$indexExists
=
isset
(
$this
->
_identifierMap
[
$path
][
$id
[
$parent
]][
$id
[
$dqlAlias
]]);
$indexExists
=
isset
(
$this
->
_identifierMap
[
$path
][
$id
[
$parent
]][
$id
[
$dqlAlias
]]);
$index
=
$indexExists
?
$this
->
_identifierMap
[
$path
][
$id
[
$parent
]][
$id
[
$dqlAlias
]]
:
false
;
$index
=
$indexExists
?
$this
->
_identifierMap
[
$path
][
$id
[
$parent
]][
$id
[
$dqlAlias
]]
:
false
;
$indexIsValid
=
$index
!==
false
?
$this
->
isIndexKeyInUse
(
$baseElement
,
$relationAlias
,
$index
)
:
false
;
$indexIsValid
=
$index
!==
false
?
$this
->
isIndexKeyInUse
(
$baseElement
,
$relationAlias
,
$index
)
:
false
;
if
(
!
$indexExists
||
!
$indexIsValid
)
{
if
(
!
$indexExists
||
!
$indexIsValid
)
{
$element
=
$this
->
getEntity
(
$data
,
$dqlAlias
);
$element
=
$this
->
getEntity
(
$data
,
$dqlAlias
);
...
@@ -397,17 +398,13 @@ class ObjectHydrator extends AbstractHydrator
...
@@ -397,17 +398,13 @@ class ObjectHydrator extends AbstractHydrator
}
}
}
else
{
}
else
{
if
(
!
$this
->
_ce
[
$parentClass
]
->
reflFields
[
$relationAlias
]
->
getValue
(
$baseElement
))
{
if
(
!
$this
->
_ce
[
$parentClass
]
->
reflFields
[
$relationAlias
]
->
getValue
(
$baseElement
))
{
if
(
!
isset
(
$nonemptyComponents
[
$dqlAlias
]))
{
if
(
isset
(
$nonemptyComponents
[
$dqlAlias
]))
{
//$this->setRelatedElement($baseElement, $relationAlias, null);
}
else
{
$this
->
setRelatedElement
(
$baseElement
,
$relationAlias
,
$this
->
getEntity
(
$data
,
$dqlAlias
));
$this
->
setRelatedElement
(
$baseElement
,
$relationAlias
,
$this
->
getEntity
(
$data
,
$dqlAlias
));
}
}
}
}
}
}
$coll
=
$this
->
_ce
[
$parentClass
]
$coll
=
$this
->
_ce
[
$parentClass
]
->
reflFields
[
$relationAlias
]
->
getValue
(
$baseElement
);
->
reflFields
[
$relationAlias
]
->
getValue
(
$baseElement
);
if
(
$coll
!==
null
)
{
if
(
$coll
!==
null
)
{
$this
->
updateResultPointer
(
$coll
,
$index
,
$dqlAlias
);
$this
->
updateResultPointer
(
$coll
,
$index
,
$dqlAlias
);
...
...
lib/Doctrine/ORM/Persisters/StandardEntityPersister.php
View file @
0c8a35f7
...
@@ -87,6 +87,9 @@ class StandardEntityPersister
...
@@ -87,6 +87,9 @@ class StandardEntityPersister
* Initializes a new instance of a class derived from AbstractEntityPersister
* Initializes a new instance of a class derived from AbstractEntityPersister
* that uses the given EntityManager and persists instances of the class described
* that uses the given EntityManager and persists instances of the class described
* by the given class metadata descriptor.
* by the given class metadata descriptor.
*
* @param EntityManager $em
* @param ClassMetadata $class
*/
*/
public
function
__construct
(
EntityManager
$em
,
ClassMetadata
$class
)
public
function
__construct
(
EntityManager
$em
,
ClassMetadata
$class
)
{
{
...
@@ -394,20 +397,19 @@ class StandardEntityPersister
...
@@ -394,20 +397,19 @@ class StandardEntityPersister
*
*
* @param array $criteria
* @param array $criteria
* @return string The SQL.
* @return string The SQL.
* @todo Quote identifier.
*/
*/
protected
function
_getSelectSingleEntitySql
(
array
$criteria
)
protected
function
_getSelectSingleEntitySql
(
array
$criteria
)
{
{
$columnList
=
''
;
$columnList
=
''
;
foreach
(
$this
->
_class
->
columnNames
as
$column
)
{
foreach
(
$this
->
_class
->
columnNames
as
$column
)
{
if
(
$columnList
!=
''
)
$columnList
.=
', '
;
if
(
$columnList
!=
''
)
$columnList
.=
', '
;
$columnList
.=
$
column
;
$columnList
.=
$
this
->
_conn
->
quoteIdentifier
(
$column
)
;
}
}
$conditionSql
=
''
;
$conditionSql
=
''
;
foreach
(
$criteria
as
$field
=>
$value
)
{
foreach
(
$criteria
as
$field
=>
$value
)
{
if
(
$conditionSql
!=
''
)
$conditionSql
.=
' AND '
;
if
(
$conditionSql
!=
''
)
$conditionSql
.=
' AND '
;
$conditionSql
.=
$this
->
_c
lass
->
columnNames
[
$field
]
.
' = ?'
;
$conditionSql
.=
$this
->
_c
onn
->
quoteIdentifier
(
$this
->
_class
->
columnNames
[
$field
])
.
' = ?'
;
}
}
return
'SELECT '
.
$columnList
.
' FROM '
.
$this
->
_class
->
getTableName
()
return
'SELECT '
.
$columnList
.
' FROM '
.
$this
->
_class
->
getTableName
()
...
...
lib/Doctrine/ORM/UnitOfWork.php
View file @
0c8a35f7
...
@@ -1355,6 +1355,10 @@ class UnitOfWork implements PropertyChangedListener
...
@@ -1355,6 +1355,10 @@ class UnitOfWork implements PropertyChangedListener
foreach
(
$data
as
$field
=>
$value
)
{
foreach
(
$data
as
$field
=>
$value
)
{
if
(
isset
(
$class
->
reflFields
[
$field
]))
{
if
(
isset
(
$class
->
reflFields
[
$field
]))
{
$currentValue
=
$class
->
reflFields
[
$field
]
->
getValue
(
$entity
);
$currentValue
=
$class
->
reflFields
[
$field
]
->
getValue
(
$entity
);
// Only override the current value if:
// a) There was no original value yet (nothing in _originalEntityData)
// or
// b) The original value is the same as the current value (it was not changed).
if
(
!
isset
(
$this
->
_originalEntityData
[
$oid
][
$field
])
||
if
(
!
isset
(
$this
->
_originalEntityData
[
$oid
][
$field
])
||
$currentValue
==
$this
->
_originalEntityData
[
$oid
][
$field
])
{
$currentValue
==
$this
->
_originalEntityData
[
$oid
][
$field
])
{
$class
->
reflFields
[
$field
]
->
setValue
(
$entity
,
$value
);
$class
->
reflFields
[
$field
]
->
setValue
(
$entity
,
$value
);
...
@@ -1469,7 +1473,9 @@ class UnitOfWork implements PropertyChangedListener
...
@@ -1469,7 +1473,9 @@ class UnitOfWork implements PropertyChangedListener
public
function
size
()
public
function
size
()
{
{
$count
=
0
;
$count
=
0
;
foreach
(
$this
->
_identityMap
as
$entitySet
)
$count
+=
count
(
$entitySet
);
foreach
(
$this
->
_identityMap
as
$entitySet
)
{
$count
+=
count
(
$entitySet
);
}
return
$count
;
return
$count
;
}
}
...
...
tests/Doctrine/Tests/ORM/Performance/HydrationPerformanceTest.php
View file @
0c8a35f7
...
@@ -20,9 +20,9 @@ class HydrationPerformanceTest extends \Doctrine\Tests\OrmPerformanceTestCase
...
@@ -20,9 +20,9 @@ class HydrationPerformanceTest extends \Doctrine\Tests\OrmPerformanceTestCase
/**
/**
* Times for comparison:
* Times for comparison:
*
*
* [romanb: 10000 rows => 1
.8 seconds
]
* [romanb: 10000 rows => 1
second
]
*
*
* MAXIMUM TIME:
3
seconds
* MAXIMUM TIME:
2
seconds
*/
*/
public
function
testSimpleQueryArrayHydrationPerformance
()
public
function
testSimpleQueryArrayHydrationPerformance
()
{
{
...
@@ -68,7 +68,7 @@ class HydrationPerformanceTest extends \Doctrine\Tests\OrmPerformanceTestCase
...
@@ -68,7 +68,7 @@ class HydrationPerformanceTest extends \Doctrine\Tests\OrmPerformanceTestCase
$stmt
=
new
HydratorMockStatement
(
$resultSet
);
$stmt
=
new
HydratorMockStatement
(
$resultSet
);
$hydrator
=
new
\Doctrine\ORM\Internal\Hydration\ArrayHydrator
(
$this
->
_em
);
$hydrator
=
new
\Doctrine\ORM\Internal\Hydration\ArrayHydrator
(
$this
->
_em
);
$this
->
setMaxRunningTime
(
3
);
$this
->
setMaxRunningTime
(
2
);
$s
=
microtime
(
true
);
$s
=
microtime
(
true
);
$result
=
$hydrator
->
hydrateAll
(
$stmt
,
$rsm
);
$result
=
$hydrator
->
hydrateAll
(
$stmt
,
$rsm
);
$e
=
microtime
(
true
);
$e
=
microtime
(
true
);
...
@@ -78,9 +78,9 @@ class HydrationPerformanceTest extends \Doctrine\Tests\OrmPerformanceTestCase
...
@@ -78,9 +78,9 @@ class HydrationPerformanceTest extends \Doctrine\Tests\OrmPerformanceTestCase
/**
/**
* Times for comparison:
* Times for comparison:
*
*
* [romanb: 10000 rows =>
3.0
seconds]
* [romanb: 10000 rows =>
1.4
seconds]
*
*
* MAXIMUM TIME:
4
seconds
* MAXIMUM TIME:
3
seconds
*/
*/
public
function
testMixedQueryFetchJoinArrayHydrationPerformance
()
public
function
testMixedQueryFetchJoinArrayHydrationPerformance
()
{
{
...
@@ -142,7 +142,7 @@ class HydrationPerformanceTest extends \Doctrine\Tests\OrmPerformanceTestCase
...
@@ -142,7 +142,7 @@ class HydrationPerformanceTest extends \Doctrine\Tests\OrmPerformanceTestCase
$stmt
=
new
HydratorMockStatement
(
$resultSet
);
$stmt
=
new
HydratorMockStatement
(
$resultSet
);
$hydrator
=
new
\Doctrine\ORM\Internal\Hydration\ArrayHydrator
(
$this
->
_em
);
$hydrator
=
new
\Doctrine\ORM\Internal\Hydration\ArrayHydrator
(
$this
->
_em
);
$this
->
setMaxRunningTime
(
4
);
$this
->
setMaxRunningTime
(
3
);
$s
=
microtime
(
true
);
$s
=
microtime
(
true
);
$result
=
$hydrator
->
hydrateAll
(
$stmt
,
$rsm
);
$result
=
$hydrator
->
hydrateAll
(
$stmt
,
$rsm
);
$e
=
microtime
(
true
);
$e
=
microtime
(
true
);
...
@@ -150,9 +150,9 @@ class HydrationPerformanceTest extends \Doctrine\Tests\OrmPerformanceTestCase
...
@@ -150,9 +150,9 @@ class HydrationPerformanceTest extends \Doctrine\Tests\OrmPerformanceTestCase
}
}
/**
/**
* [romanb: 10000 rows =>
3.8
seconds]
* [romanb: 10000 rows =>
1.5
seconds]
*
*
* MAXIMUM TIME:
5
seconds
* MAXIMUM TIME:
3
seconds
*/
*/
public
function
testSimpleQueryObjectHydrationPerformance
()
public
function
testSimpleQueryObjectHydrationPerformance
()
{
{
...
@@ -198,7 +198,7 @@ class HydrationPerformanceTest extends \Doctrine\Tests\OrmPerformanceTestCase
...
@@ -198,7 +198,7 @@ class HydrationPerformanceTest extends \Doctrine\Tests\OrmPerformanceTestCase
$stmt
=
new
HydratorMockStatement
(
$resultSet
);
$stmt
=
new
HydratorMockStatement
(
$resultSet
);
$hydrator
=
new
\Doctrine\ORM\Internal\Hydration\ObjectHydrator
(
$this
->
_em
);
$hydrator
=
new
\Doctrine\ORM\Internal\Hydration\ObjectHydrator
(
$this
->
_em
);
$this
->
setMaxRunningTime
(
5
);
$this
->
setMaxRunningTime
(
3
);
$s
=
microtime
(
true
);
$s
=
microtime
(
true
);
$result
=
$hydrator
->
hydrateAll
(
$stmt
,
$rsm
);
$result
=
$hydrator
->
hydrateAll
(
$stmt
,
$rsm
);
$e
=
microtime
(
true
);
$e
=
microtime
(
true
);
...
@@ -206,9 +206,9 @@ class HydrationPerformanceTest extends \Doctrine\Tests\OrmPerformanceTestCase
...
@@ -206,9 +206,9 @@ class HydrationPerformanceTest extends \Doctrine\Tests\OrmPerformanceTestCase
}
}
/**
/**
* [romanb: 2000 rows =>
3.1 seconds
]
* [romanb: 2000 rows =>
1 second
]
*
*
* MAXIMUM TIME:
4
seconds
* MAXIMUM TIME:
2
seconds
*/
*/
public
function
testMixedQueryFetchJoinObjectHydrationPerformance
()
public
function
testMixedQueryFetchJoinObjectHydrationPerformance
()
{
{
...
@@ -270,7 +270,7 @@ class HydrationPerformanceTest extends \Doctrine\Tests\OrmPerformanceTestCase
...
@@ -270,7 +270,7 @@ class HydrationPerformanceTest extends \Doctrine\Tests\OrmPerformanceTestCase
$stmt
=
new
HydratorMockStatement
(
$resultSet
);
$stmt
=
new
HydratorMockStatement
(
$resultSet
);
$hydrator
=
new
\Doctrine\ORM\Internal\Hydration\ObjectHydrator
(
$this
->
_em
);
$hydrator
=
new
\Doctrine\ORM\Internal\Hydration\ObjectHydrator
(
$this
->
_em
);
$this
->
setMaxRunningTime
(
4
);
$this
->
setMaxRunningTime
(
2
);
$s
=
microtime
(
true
);
$s
=
microtime
(
true
);
$result
=
$hydrator
->
hydrateAll
(
$stmt
,
$rsm
);
$result
=
$hydrator
->
hydrateAll
(
$stmt
,
$rsm
);
$e
=
microtime
(
true
);
$e
=
microtime
(
true
);
...
...
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