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
d8352d67
Commit
d8352d67
authored
Sep 10, 2007
by
jackbravo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Substitute array_diff function with array_udiff to allow overriding __toString()
parent
0436fc8e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
3 deletions
+12
-3
Collection.php
lib/Doctrine/Collection.php
+12
-3
No files found.
lib/Doctrine/Collection.php
View file @
d8352d67
...
...
@@ -577,7 +577,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
*/
public
function
processDiff
()
{
foreach
(
array_
diff
(
$this
->
_snapshot
,
$this
->
data
)
as
$record
)
{
foreach
(
array_
udiff
(
$this
->
_snapshot
,
$this
->
data
,
array
(
$this
,
"compareRecords"
)
)
as
$record
)
{
$record
->
delete
();
}
...
...
@@ -605,11 +605,20 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
}
public
function
getDeleteDiff
()
{
return
array_
diff
(
$this
->
_snapshot
,
$this
->
data
);
return
array_
udiff
(
$this
->
_snapshot
,
$this
->
data
,
array
(
$this
,
"compareRecords"
)
);
}
public
function
getInsertDiff
()
{
return
array_diff
(
$this
->
data
,
$this
->
_snapshot
);
return
array_udiff
(
$this
->
data
,
$this
->
_snapshot
,
array
(
$this
,
"compareRecords"
));
}
/**
* compareRecords
* Compares two records. To be used on _snapshot diffs using array_udiff
*/
protected
function
compareRecords
(
$a
,
$b
)
{
if
(
$a
->
getOid
()
==
$b
->
getOid
())
return
0
;
return
(
$a
->
getOid
()
>
$b
->
getOid
())
?
1
:
-
1
;
}
/**
* save
...
...
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