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
edb1b251
Commit
edb1b251
authored
Sep 01, 2007
by
romanb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Applied the patch from Jackbravo (ticket #441)
parent
e2be550a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
104 deletions
+23
-104
Hydrate.php
lib/Doctrine/Hydrate.php
+23
-104
No files found.
lib/Doctrine/Hydrate.php
View file @
edb1b251
...
@@ -968,10 +968,6 @@ class Doctrine_Hydrate extends Doctrine_Object implements Serializable
...
@@ -968,10 +968,6 @@ class Doctrine_Hydrate extends Doctrine_Object implements Serializable
$rootMap
=
reset
(
$this
->
_aliasMap
);
$rootMap
=
reset
(
$this
->
_aliasMap
);
$rootAlias
=
key
(
$this
->
_aliasMap
);
$rootAlias
=
key
(
$this
->
_aliasMap
);
$componentName
=
$rootMap
[
'table'
]
->
getComponentName
();
$componentName
=
$rootMap
[
'table'
]
->
getComponentName
();
$index
=
0
;
$incr
=
true
;
$lastAlias
=
''
;
$currData
=
array
();
if
(
$hydrationMode
===
null
)
{
if
(
$hydrationMode
===
null
)
{
$hydrationMode
=
$this
->
_hydrationMode
;
$hydrationMode
=
$this
->
_hydrationMode
;
...
@@ -984,14 +980,14 @@ class Doctrine_Hydrate extends Doctrine_Object implements Serializable
...
@@ -984,14 +980,14 @@ class Doctrine_Hydrate extends Doctrine_Object implements Serializable
}
}
$array
=
$driver
->
getElementCollection
(
$componentName
);
$array
=
$driver
->
getElementCollection
(
$componentName
);
$identifiable
=
array
();
if
(
$stmt
===
false
||
$stmt
===
0
)
{
if
(
$stmt
===
false
||
$stmt
===
0
)
{
return
$array
;
return
$array
;
}
}
while
(
$data
=
$stmt
->
fetch
(
Doctrine
::
FETCH_ASSOC
))
{
while
(
$data
=
$stmt
->
fetch
(
Doctrine
::
FETCH_ASSOC
))
{
$parse
=
true
;
$currData
=
array
();
$identifiable
=
array
();
foreach
(
$data
as
$key
=>
$value
)
{
foreach
(
$data
as
$key
=>
$value
)
{
...
@@ -1015,14 +1011,6 @@ class Doctrine_Hydrate extends Doctrine_Object implements Serializable
...
@@ -1015,14 +1011,6 @@ class Doctrine_Hydrate extends Doctrine_Object implements Serializable
}
}
$componentName
=
$map
[
'table'
]
->
getComponentName
();
if
(
isset
(
$map
[
'relation'
]))
{
$componentAlias
=
$map
[
'relation'
]
->
getAlias
();
}
else
{
$componentAlias
=
$map
[
'table'
]
->
getComponentName
();
}
if
(
!
isset
(
$currData
[
$alias
]))
{
if
(
!
isset
(
$currData
[
$alias
]))
{
$currData
[
$alias
]
=
array
();
$currData
[
$alias
]
=
array
();
}
}
...
@@ -1031,99 +1019,36 @@ class Doctrine_Hydrate extends Doctrine_Object implements Serializable
...
@@ -1031,99 +1019,36 @@ class Doctrine_Hydrate extends Doctrine_Object implements Serializable
$prev
[
$alias
]
=
array
();
$prev
[
$alias
]
=
array
();
}
}
$skip
=
false
;
if
((
$alias
!==
$lastAlias
||
$parse
)
&&
!
empty
(
$currData
[
$alias
]))
{
// component changed
$element
=
$driver
->
getElement
(
$currData
[
$alias
],
$componentName
);
$oneToOne
=
false
;
if
(
$alias
===
$rootAlias
)
{
// dealing with root component
$index
=
$driver
->
search
(
$element
,
$array
);
if
(
$index
===
false
)
{
$array
[]
=
$element
;
}
$coll
=&
$array
;
}
else
{
$parent
=
$map
[
'parent'
];
$relation
=
$map
[
'relation'
];
if
(
!
isset
(
$prev
[
$parent
]))
{
break
;
}
// check the type of the relation
if
(
!
$relation
->
isOneToOne
())
{
// initialize the collection
if
(
$driver
->
initRelated
(
$prev
[
$parent
],
$componentAlias
))
{
// append element
if
(
isset
(
$identifiable
[
$alias
]))
{
$index
=
$driver
->
search
(
$element
,
$prev
[
$parent
][
$componentAlias
]);
if
(
$index
===
false
)
{
$prev
[
$parent
][
$componentAlias
][]
=
$element
;
}
}
// register collection for later snapshots
$driver
->
registerCollection
(
$prev
[
$parent
][
$componentAlias
]);
}
}
else
{
if
(
!
isset
(
$identifiable
[
$alias
]))
{
$prev
[
$parent
][
$componentAlias
]
=
$driver
->
getNullPointer
();
}
else
{
$prev
[
$parent
][
$componentAlias
]
=
$element
;
}
$oneToOne
=
true
;
}
$coll
=&
$prev
[
$parent
][
$componentAlias
];
}
$this
->
_setLastElement
(
$prev
,
$coll
,
$index
,
$alias
,
$oneToOne
);
$currData
[
$alias
]
=
array
();
$identifiable
[
$alias
]
=
null
;
}
$currData
[
$alias
][
$field
]
=
$table
->
prepareValue
(
$field
,
$value
);
$currData
[
$alias
][
$field
]
=
$table
->
prepareValue
(
$field
,
$value
);
$index
=
false
;
if
(
$value
!==
null
)
{
if
(
$value
!==
null
)
{
$identifiable
[
$alias
]
=
true
;
$identifiable
[
$alias
]
=
true
;
}
}
$lastAlias
=
$alias
;
$parse
=
false
;
}
}
}
foreach
(
$currData
as
$alias
=>
$data
)
{
// dealing with root component
$table
=
$this
->
_aliasMap
[
$
a
lias
][
'table'
];
$table
=
$this
->
_aliasMap
[
$
rootA
lias
][
'table'
];
$componentName
=
$table
->
getComponentName
();
$componentName
=
$table
->
getComponentName
();
// component changed
$element
=
$driver
->
getElement
(
$currData
[
$rootAlias
],
$componentName
);
$element
=
$driver
->
getElement
(
$currData
[
$alias
],
$componentName
);
$oneToOne
=
false
;
$oneToOne
=
false
;
if
(
$alias
===
$rootAlias
)
{
$index
=
$driver
->
search
(
$element
,
$array
);
// dealing with root component
if
(
$index
===
false
)
{
$index
=
$driver
->
search
(
$element
,
$array
);
$array
[]
=
$element
;
if
(
$index
===
false
)
{
}
$array
[]
=
$element
;
$this
->
_setLastElement
(
$prev
,
$array
,
$index
,
$rootAlias
,
$oneToOne
);
}
unset
(
$currData
[
$rootAlias
]);
$coll
=&
$array
;
}
else
{
foreach
(
$currData
as
$alias
=>
$data
)
{
$parent
=
$this
->
_aliasMap
[
$alias
][
'parent'
];
$index
=
false
;
$relation
=
$this
->
_aliasMap
[
$alias
][
'relation'
];
$map
=
$this
->
_aliasMap
[
$alias
];
$componentAlias
=
$relation
->
getAlias
();
$table
=
$this
->
_aliasMap
[
$alias
][
'table'
];
$componentName
=
$table
->
getComponentName
();
$element
=
$driver
->
getElement
(
$data
,
$componentName
);
$parent
=
$map
[
'parent'
];
$relation
=
$map
[
'relation'
];
$componentAlias
=
$map
[
'relation'
]
->
getAlias
();
if
(
!
isset
(
$prev
[
$parent
]))
{
if
(
!
isset
(
$prev
[
$parent
]))
{
break
;
break
;
...
@@ -1150,19 +1075,13 @@ class Doctrine_Hydrate extends Doctrine_Object implements Serializable
...
@@ -1150,19 +1075,13 @@ class Doctrine_Hydrate extends Doctrine_Object implements Serializable
if
(
!
isset
(
$identifiable
[
$alias
]))
{
if
(
!
isset
(
$identifiable
[
$alias
]))
{
$prev
[
$parent
][
$componentAlias
]
=
$driver
->
getNullPointer
();
$prev
[
$parent
][
$componentAlias
]
=
$driver
->
getNullPointer
();
}
else
{
}
else
{
$prev
[
$parent
][
$componentAlias
]
=
$element
;
$prev
[
$parent
][
$componentAlias
]
=
$element
;
}
}
$oneToOne
=
true
;
$oneToOne
=
true
;
}
}
$coll
=&
$prev
[
$parent
][
$componentAlias
];
$coll
=&
$prev
[
$parent
][
$componentAlias
];
$this
->
_setLastElement
(
$prev
,
$coll
,
$index
,
$alias
,
$oneToOne
);
}
}
$this
->
_setLastElement
(
$prev
,
$coll
,
$index
,
$alias
,
$oneToOne
);
$index
=
false
;
$currData
[
$alias
]
=
array
();
unset
(
$identifiable
[
$alias
]);
}
}
$driver
->
flush
();
$driver
->
flush
();
...
...
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