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
42ef7176
Commit
42ef7176
authored
Jul 01, 2007
by
romanb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Introduced setHydrationMode() and new hydration constants.
parent
0077a220
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
9 deletions
+35
-9
Hydrate.php
lib/Doctrine/Hydrate.php
+35
-9
No files found.
lib/Doctrine/Hydrate.php
View file @
42ef7176
...
...
@@ -58,7 +58,15 @@ class Doctrine_Hydrate extends Doctrine_Object implements Serializable
* constant for CREATE queries
*/
const
CREATE
=
4
;
/**
* Constant for the array hydration mode.
*/
const
HYDRATE_ARRAY
=
3
;
/**
* Constant for the record (object) hydration mode.
*/
const
HYDRATE_RECORD
=
2
;
/**
* @var array $params query input parameters
*/
...
...
@@ -133,6 +141,10 @@ class Doctrine_Hydrate extends Doctrine_Object implements Serializable
* @var array
*/
protected
$_cache
;
/**
* The current hydration mode.
*/
protected
$_hydrationMode
=
self
::
HYDRATE_RECORD
;
/**
* @var boolean $_expireCache a boolean value that indicates whether or not to force cache expiration
*/
...
...
@@ -248,6 +260,16 @@ class Doctrine_Hydrate extends Doctrine_Object implements Serializable
return
$this
->
_conn
->
getCacheDriver
();
}
}
/**
* Sets the fetchmode.
*
* @param integer $fetchmode One of the Doctrine_Hydrate::HYDRATE_* constants.
*/
public
function
setHydrationMode
(
$hydrationMode
)
{
$this
->
_hydrationMode
=
$hydrationMode
;
return
$this
;
}
/**
* serialize
* this method is automatically called when this Doctrine_Hydrate is serialized
...
...
@@ -722,7 +744,7 @@ class Doctrine_Hydrate extends Doctrine_Object implements Serializable
return
serialize
(
array
(
$resultSet
,
$map
,
$this
->
getTableAliases
()));
}
public
function
_execute
(
$params
,
$return
=
Doctrine
::
FETCH_RECORD
)
public
function
_execute
(
$params
)
{
$params
=
$this
->
_conn
->
convertBooleans
(
array_merge
(
$this
->
_params
,
$params
));
...
...
@@ -754,7 +776,7 @@ class Doctrine_Hydrate extends Doctrine_Object implements Serializable
* @param string $params
* @return Doctrine_Collection the root collection
*/
public
function
execute
(
$params
=
array
(),
$
return
=
Doctrine
::
FETCH_RECORD
)
public
function
execute
(
$params
=
array
(),
$
hydrationMode
=
null
)
{
if
(
$this
->
_cache
)
{
$cacheDriver
=
$this
->
getCacheDriver
();
...
...
@@ -768,8 +790,8 @@ class Doctrine_Hydrate extends Doctrine_Object implements Serializable
if
(
$cached
===
null
)
{
// cache miss
$stmt
=
$this
->
_execute
(
$params
,
$return
);
$array
=
$this
->
parseData2
(
$stmt
,
Doctrine
::
FETCH
_ARRAY
);
$stmt
=
$this
->
_execute
(
$params
);
$array
=
$this
->
parseData2
(
$stmt
,
self
::
HYDRATE
_ARRAY
);
$cached
=
$this
->
getCachedForm
(
$array
);
...
...
@@ -796,13 +818,13 @@ class Doctrine_Hydrate extends Doctrine_Object implements Serializable
$this
->
_aliasMap
=
$map
;
}
}
else
{
$stmt
=
$this
->
_execute
(
$params
,
$return
);
$stmt
=
$this
->
_execute
(
$params
);
if
(
is_integer
(
$stmt
))
{
return
$stmt
;
}
$array
=
$this
->
parseData2
(
$stmt
,
$
return
);
$array
=
$this
->
parseData2
(
$stmt
,
$
hydrationMode
);
}
return
$array
;
}
...
...
@@ -895,7 +917,7 @@ class Doctrine_Hydrate extends Doctrine_Object implements Serializable
* @param mixed $stmt
* @return array
*/
public
function
parseData2
(
$stmt
,
$
return
)
public
function
parseData2
(
$stmt
,
$
hydrationMode
)
{
$cache
=
array
();
...
...
@@ -907,7 +929,11 @@ class Doctrine_Hydrate extends Doctrine_Object implements Serializable
$lastAlias
=
''
;
$currData
=
array
();
if
(
$return
===
Doctrine
::
FETCH_ARRAY
)
{
if
(
$hydrationMode
===
null
)
{
$hydrationMode
=
$this
->
_hydrationMode
;
}
if
(
$hydrationMode
===
self
::
HYDRATE_ARRAY
)
{
$driver
=
new
Doctrine_Hydrate_Array
();
}
else
{
$driver
=
new
Doctrine_Hydrate_Record
();
...
...
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