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
28fba54f
Commit
28fba54f
authored
Dec 02, 2007
by
romanb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Another hydrator speed improvement.
parent
5e264733
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
16 deletions
+35
-16
Hydrator.php
lib/Doctrine/Hydrator.php
+14
-2
Table.php
lib/Doctrine/Table.php
+21
-14
No files found.
lib/Doctrine/Hydrator.php
View file @
28fba54f
...
@@ -294,6 +294,14 @@ class Doctrine_Hydrator extends Doctrine_Hydrator_Abstract
...
@@ -294,6 +294,14 @@ class Doctrine_Hydrator extends Doctrine_Hydrator_Abstract
$cache
[
$key
][
'fieldName'
]
=
$fieldName
;
$cache
[
$key
][
'fieldName'
]
=
$fieldName
;
if
(
$table
->
isIdentifier
(
$fieldName
))
{
if
(
$table
->
isIdentifier
(
$fieldName
))
{
$cache
[
$key
][
'isIdentifier'
]
=
true
;
$cache
[
$key
][
'isIdentifier'
]
=
true
;
}
else
{
$cache
[
$key
][
'isIdentifier'
]
=
false
;
}
$type
=
$table
->
getTypeOfColumn
(
$last
);
if
(
$type
==
'integer'
||
$type
==
'string'
)
{
$cache
[
$key
][
'isSimpleType'
]
=
true
;
}
else
{
$cache
[
$key
][
'isSimpleType'
]
=
false
;
}
}
}
}
...
@@ -306,11 +314,15 @@ class Doctrine_Hydrator extends Doctrine_Hydrator_Abstract
...
@@ -306,11 +314,15 @@ class Doctrine_Hydrator extends Doctrine_Hydrator_Abstract
$fieldName
=
$this
->
_queryComponents
[
$dqlAlias
][
'agg'
][
$fieldName
];
$fieldName
=
$this
->
_queryComponents
[
$dqlAlias
][
'agg'
][
$fieldName
];
}
}
if
(
isset
(
$cache
[
$key
][
'isIdentifier'
])
)
{
if
(
$cache
[
$key
][
'isIdentifier'
]
)
{
$id
[
$dqlAlias
]
.=
'|'
.
$value
;
$id
[
$dqlAlias
]
.=
'|'
.
$value
;
}
}
$rowData
[
$dqlAlias
][
$fieldName
]
=
$table
->
prepareValue
(
$fieldName
,
$value
);
if
(
$cache
[
$key
][
'isSimpleType'
])
{
$rowData
[
$dqlAlias
][
$fieldName
]
=
$value
;
}
else
{
$rowData
[
$dqlAlias
][
$fieldName
]
=
$table
->
prepareValue
(
$fieldName
,
$value
);
}
if
(
!
isset
(
$nonemptyComponents
[
$dqlAlias
])
&&
$value
!==
null
)
{
if
(
!
isset
(
$nonemptyComponents
[
$dqlAlias
])
&&
$value
!==
null
)
{
$nonemptyComponents
[
$dqlAlias
]
=
true
;
$nonemptyComponents
[
$dqlAlias
]
=
true
;
...
...
lib/Doctrine/Table.php
View file @
28fba54f
...
@@ -1554,11 +1554,17 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
...
@@ -1554,11 +1554,17 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
*/
*/
public
function
getTypeOf
(
$fieldName
)
public
function
getTypeOf
(
$fieldName
)
{
{
$columnName
=
$this
->
getColumnName
(
$fieldName
);
return
$this
->
getTypeOfColumn
(
$this
->
getColumnName
(
$fieldName
));
if
(
isset
(
$this
->
_columns
[
$columnName
]))
{
}
return
$this
->
_columns
[
$columnName
][
'type'
];
}
/**
return
false
;
* getTypeOfColumn
*
* @return mixed The column type or FALSE if the type cant be determined.
*/
public
function
getTypeOfColumn
(
$columnName
)
{
return
isset
(
$this
->
_columns
[
$columnName
])
?
$this
->
_columns
[
$columnName
][
'type'
]
:
false
;
}
}
/**
/**
...
@@ -1618,6 +1624,16 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
...
@@ -1618,6 +1624,16 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
$type
=
$this
->
getTypeOf
(
$fieldName
);
$type
=
$this
->
getTypeOf
(
$fieldName
);
switch
(
$type
)
{
switch
(
$type
)
{
case
'integer'
:
case
'string'
;
// don't do any casting here PHP INT_MAX is smaller than what the databases support
break
;
case
'enum'
:
return
$this
->
enumValue
(
$fieldName
,
$value
);
break
;
case
'boolean'
:
return
(
boolean
)
$value
;
break
;
case
'array'
:
case
'array'
:
case
'object'
:
case
'object'
:
if
(
is_string
(
$value
))
{
if
(
is_string
(
$value
))
{
...
@@ -1637,15 +1653,6 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
...
@@ -1637,15 +1653,6 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
}
}
return
$value
;
return
$value
;
break
;
break
;
case
'enum'
:
return
$this
->
enumValue
(
$fieldName
,
$value
);
break
;
case
'boolean'
:
return
(
boolean
)
$value
;
break
;
case
'integer'
:
// don't do any casting here PHP INT_MAX is smaller than what the databases support
break
;
}
}
}
}
return
$value
;
return
$value
;
...
...
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