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
ec292991
Commit
ec292991
authored
Oct 13, 2007
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
huge speed improvement for hydration hooks
parent
baf09de8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
4 deletions
+13
-4
Hydrate.php
lib/Doctrine/Hydrate.php
+13
-4
No files found.
lib/Doctrine/Hydrate.php
View file @
ec292991
...
@@ -988,6 +988,15 @@ class Doctrine_Hydrate extends Doctrine_Locator_Injectable implements Serializab
...
@@ -988,6 +988,15 @@ class Doctrine_Hydrate extends Doctrine_Locator_Injectable implements Serializab
$event
=
new
Doctrine_Event
(
Doctrine_Event
::
HYDRATE
,
null
);
$event
=
new
Doctrine_Event
(
Doctrine_Event
::
HYDRATE
,
null
);
// for every getRecordListener() there is a little bit
// logic behind it, hence calling it multiple times on
// large result sets can be quite expensive.
// So for efficiency we use little listener caching here
foreach
(
$this
->
_aliasMap
as
$alias
=>
$data
)
{
$componentName
=
$data
[
'table'
]
->
getComponentName
();
$listeners
[
$componentName
]
=
$data
[
'table'
]
->
getRecordListener
();
}
while
(
$data
=
$stmt
->
fetch
(
Doctrine
::
FETCH_ASSOC
))
{
while
(
$data
=
$stmt
->
fetch
(
Doctrine
::
FETCH_ASSOC
))
{
$currData
=
array
();
$currData
=
array
();
$identifiable
=
array
();
$identifiable
=
array
();
...
@@ -1033,7 +1042,7 @@ class Doctrine_Hydrate extends Doctrine_Locator_Injectable implements Serializab
...
@@ -1033,7 +1042,7 @@ class Doctrine_Hydrate extends Doctrine_Locator_Injectable implements Serializab
$table
=
$this
->
_aliasMap
[
$rootAlias
][
'table'
];
$table
=
$this
->
_aliasMap
[
$rootAlias
][
'table'
];
$componentName
=
$table
->
getComponentName
();
$componentName
=
$table
->
getComponentName
();
$event
->
set
(
'data'
,
$currData
[
$rootAlias
]);
$event
->
set
(
'data'
,
$currData
[
$rootAlias
]);
$
table
->
getRecordListener
()
->
preHydrate
(
$event
);
$
listeners
[
$componentName
]
->
preHydrate
(
$event
);
$element
=
$driver
->
getElement
(
$currData
[
$rootAlias
],
$componentName
);
$element
=
$driver
->
getElement
(
$currData
[
$rootAlias
],
$componentName
);
$oneToOne
=
false
;
$oneToOne
=
false
;
...
@@ -1041,7 +1050,7 @@ class Doctrine_Hydrate extends Doctrine_Locator_Injectable implements Serializab
...
@@ -1041,7 +1050,7 @@ class Doctrine_Hydrate extends Doctrine_Locator_Injectable implements Serializab
$index
=
$driver
->
search
(
$element
,
$array
);
$index
=
$driver
->
search
(
$element
,
$array
);
if
(
$index
===
false
)
{
if
(
$index
===
false
)
{
$event
->
set
(
'data'
,
$element
);
$event
->
set
(
'data'
,
$element
);
$
table
->
getRecordListener
()
->
postHydrate
(
$event
);
$
listeners
[
$componentName
]
->
postHydrate
(
$event
);
if
(
isset
(
$this
->
_aliasMap
[
$rootAlias
][
'map'
]))
{
if
(
isset
(
$this
->
_aliasMap
[
$rootAlias
][
'map'
]))
{
$key
=
$this
->
_aliasMap
[
$rootAlias
][
'map'
];
$key
=
$this
->
_aliasMap
[
$rootAlias
][
'map'
];
...
@@ -1068,7 +1077,7 @@ class Doctrine_Hydrate extends Doctrine_Locator_Injectable implements Serializab
...
@@ -1068,7 +1077,7 @@ class Doctrine_Hydrate extends Doctrine_Locator_Injectable implements Serializab
$table
=
$this
->
_aliasMap
[
$alias
][
'table'
];
$table
=
$this
->
_aliasMap
[
$alias
][
'table'
];
$componentName
=
$table
->
getComponentName
();
$componentName
=
$table
->
getComponentName
();
$event
->
set
(
'data'
,
$data
);
$event
->
set
(
'data'
,
$data
);
$
table
->
getRecordListener
()
->
preHydrate
(
$event
);
$
listeners
[
$componentName
]
->
preHydrate
(
$event
);
$element
=
$driver
->
getElement
(
$data
,
$componentName
);
$element
=
$driver
->
getElement
(
$data
,
$componentName
);
...
@@ -1092,7 +1101,7 @@ class Doctrine_Hydrate extends Doctrine_Locator_Injectable implements Serializab
...
@@ -1092,7 +1101,7 @@ class Doctrine_Hydrate extends Doctrine_Locator_Injectable implements Serializab
if
(
$index
===
false
)
{
if
(
$index
===
false
)
{
$event
->
set
(
'data'
,
$element
);
$event
->
set
(
'data'
,
$element
);
$
table
->
getRecordListener
()
->
postHydrate
(
$event
);
$
listeners
[
$componentName
]
->
postHydrate
(
$event
);
if
(
isset
(
$map
[
'map'
]))
{
if
(
isset
(
$map
[
'map'
]))
{
$key
=
$map
[
'map'
];
$key
=
$map
[
'map'
];
...
...
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