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
5aa73029
Commit
5aa73029
authored
Sep 21, 2007
by
Jonathan.Wage
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added fromArray() methods.
parent
b574c720
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
0 deletions
+22
-0
Collection.php
lib/Doctrine/Collection.php
+12
-0
Record.php
lib/Doctrine/Record.php
+10
-0
No files found.
lib/Doctrine/Collection.php
View file @
5aa73029
...
...
@@ -603,6 +603,18 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
return
$this
->
data
;
}
}
public
function
fromArray
(
$array
)
{
$data
=
array
();
foreach
(
$array
as
$key
=>
$row
)
{
$record
=
$this
->
_table
->
getRecord
();
$record
->
fromArray
(
$row
);
$data
[
$key
]
=
$record
;
}
$this
->
data
=
$data
;
}
public
function
getDeleteDiff
()
{
return
array_udiff
(
$this
->
_snapshot
,
$this
->
data
,
array
(
$this
,
"compareRecords"
));
...
...
lib/Doctrine/Record.php
View file @
5aa73029
...
...
@@ -1139,6 +1139,16 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
}
return
array_merge
(
$a
,
$this
->
_values
);
}
public
function
fromArray
(
$array
)
{
foreach
(
$array
as
$key
=>
$value
)
{
if
(
!
$this
->
getTable
()
->
hasRelation
(
$key
)
&&
$this
->
getTable
()
->
hasColumn
(
$key
))
{
$this
->
$key
=
$value
;
}
else
{
$this
->
$key
->
fromArray
(
$value
);
}
}
}
/**
* exists
* returns true if this record is persistent, otherwise false
...
...
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