On Aug 1, 2006, at 8:27 PM, John Siracusa wrote:
> Ah, gotcha. But how would the functionality you describe be
> implemented?
> You want a method call on an object that's part of a list being
> iterated
> over to cause that object to delete itself from the list. That's
> pretty
> spooky behavior, and I'm not sure how many people would expect it
> to work
> that way.
ok. i have no idea.
maybe there's something a little different...
delete() deletes in the db, and internally logs/marks the item
purge() would operate on a result set, look for items marked
deleted, and then splice the array
in practice it would be:
my $rose= Rose::DB::Object->get();
foreach my $item ( @$rose ) {
foreach my $suborindate ( @$item{subordinates} ) {
if ( $test ) {
$suborindate->delete();
}
}
if ( $test ) {
$item->delete();
}
}
$rose->purge();
purge would then reflexively loop the result set, looking for items
marked deleted first as items, then subordinates ( no need to work
backwards, as a parent would clear a child ), and splice the list
accordingly.
its a half brained / half assed idea-- i'm sure there are better
ways- and this would need to be a future planning thing.
as-is though, rose is a bit odd -- you can't really loop the same
object 2x in code if there's a delete
which also brings up another idea:
how about including a null hash/array for with_object relationships
that don't match? i find myself testing for these things a lot. am
i the only one who keep running into this?
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Rose-db-object mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rose-db-object