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
65442c74
Commit
65442c74
authored
Feb 29, 2008
by
guilhermeblanco
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added free( = false) support in Doctrine_Record and Doctrine_Collection (trunk)
parent
a6a5192f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
6 deletions
+35
-6
Collection.php
lib/Doctrine/Collection.php
+18
-0
Record.php
lib/Doctrine/Record.php
+17
-6
No files found.
lib/Doctrine/Collection.php
View file @
65442c74
...
...
@@ -912,6 +912,24 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
return
$this
;
}
public
function
free
(
$deep
=
false
)
{
foreach
(
$this
->
getData
()
as
$key
=>
$record
)
{
if
(
!
(
$record
instanceof
Doctrine_Null
))
{
$record
->
free
(
$deep
);
}
}
$this
->
data
=
array
();
if
(
$this
->
reference
)
{
$this
->
reference
->
free
(
$deep
);
$this
->
reference
=
null
;
}
}
/**
* getIterator
* @return object ArrayIterator
...
...
lib/Doctrine/Record.php
View file @
65442c74
...
...
@@ -1902,11 +1902,22 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
*/
public
function
free
()
{
$this
->
_mapper
->
detach
(
$this
);
$this
->
_mapper
->
removeRecord
(
$this
);
$this
->
_data
=
array
();
$this
->
_id
=
array
();
$this
->
_references
=
array
();
if
(
$this
->
_state
!=
self
::
STATE_LOCKED
)
{
$this
->
_mapper
->
detach
(
$this
);
$this
->
_mapper
->
removeRecord
(
$this
);
$this
->
_data
=
array
();
$this
->
_id
=
array
();
if
(
$deep
)
{
foreach
(
$this
->
_references
as
$name
=>
$reference
)
{
if
(
!
(
$reference
instanceof
Doctrine_Null
))
{
$reference
->
free
(
$deep
);
}
}
}
$this
->
_references
=
array
();
}
}
}
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