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
12a9f30a
Commit
12a9f30a
authored
May 30, 2007
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--no commit message
--no commit message
parent
ecbecaa6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
11 deletions
+42
-11
Array.php
lib/Doctrine/Hydrate/Array.php
+4
-0
Record.php
lib/Doctrine/Hydrate/Record.php
+38
-11
No files found.
lib/Doctrine/Hydrate/Array.php
View file @
12a9f30a
...
...
@@ -41,6 +41,10 @@ class Doctrine_Hydrate_Array
{
return
$data
;
}
public
function
isIdentifiable
(
array
$data
,
Doctrine_Table
$table
)
{
return
true
;
}
public
function
registerCollection
(
$coll
)
{
...
...
lib/Doctrine/Hydrate/Record.php
View file @
12a9f30a
...
...
@@ -36,6 +36,8 @@ class Doctrine_Hydrate_Record
protected
$_collections
=
array
();
protected
$_records
=
array
();
protected
$_tables
=
array
();
public
function
getElementCollection
(
$component
)
{
...
...
@@ -46,19 +48,46 @@ class Doctrine_Hydrate_Record
}
public
function
registerCollection
(
$coll
)
{
if
(
!
is_object
(
$coll
))
{
throw
new
Exception
();
}
$this
->
_collections
[]
=
$coll
;
}
/**
* isIdentifiable
* returns whether or not a given data row is identifiable (it contains
* all primary key fields specified in the second argument)
*
* @param array $row
* @param Doctrine_Table $table
* @return boolean
*/
public
function
isIdentifiable
(
array
$row
,
Doctrine_Table
$table
)
{
$primaryKeys
=
$table
->
getIdentifier
();
if
(
is_array
(
$primaryKeys
))
{
foreach
(
$primaryKeys
as
$id
)
{
if
(
!
isset
(
$row
[
$id
]))
{
return
false
;
}
}
}
else
{
if
(
!
isset
(
$row
[
$primaryKeys
]))
{
return
false
;
}
}
return
true
;
}
public
function
getElement
(
array
$data
,
$component
)
{
$record
=
new
$component
();
$record
->
hydrate
(
$data
);
if
(
!
isset
(
$this
->
_tables
[
$component
]))
{
$this
->
_tables
[
$component
]
=
Doctrine_Manager
::
getInstance
()
->
getTable
(
$component
);
}
$this
->
_tables
[
$component
]
->
setData
(
$data
);
$record
=
$this
->
_tables
[
$component
]
->
getRecord
();
$this
->
_records
[]
=
$record
;
$this
->
_tables
[
$component
]
->
setAttribute
(
Doctrine
::
ATTR_LOAD_REFERENCES
,
false
);
return
$record
;
}
...
...
@@ -68,10 +97,8 @@ class Doctrine_Hydrate_Record
foreach
(
array_unique
(
$this
->
_collections
)
as
$key
=>
$coll
)
{
$coll
->
takeSnapshot
();
}
foreach
(
$this
->
_records
as
$record
)
{
$record
->
state
(
Doctrine_Record
::
STATE_CLEAN
);
foreach
(
$this
->
_tables
as
$table
)
{
$table
->
setAttribute
(
Doctrine
::
ATTR_LOAD_REFERENCES
,
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