On 8/2/06 3:38 AM, Jonathan Vanasco wrote:
> as-is though, rose is a bit odd -- you can't really loop the same
> object 2x in code if there's a delete

Well, you can always splice the list yourself, which has the advantage of
being more explicit and clear to a reader:

    my $bars = $foo->bars; # reference to actual list

    my $i = 0;

    while(my $obj = $bars->[$i])
    {
      if(...)
      {
        $obj->delete;
        splice(@$bars, $i, 1);
        next;
      }

      $i++;
    }

OTOH, I can see how some people might expect this to automagically delete
the object from the list:

    foreach my $obj ($foo->bars)
    {
      $obj->delete if(...);
    }

I'll think about it.

> 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?

I think that's a bad idea.  If you're doing a lot of queries with_objects
where those objects may or may not be there, I want them to really not be
there when they're not there :)  To make the tests easier, perhaps a
has_related() Helper method?

    if($obj->has_related('bars')) { ... }

-John



-------------------------------------------------------------------------
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
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to