John Siracusa scribbled on 3/9/07 9:45 AM:
> On 3/9/07, Peter Karman <[EMAIL PROTECTED]> wrote:
>> But I don't get this magical method:
>>
>>    $product->delete_prices($price_id);
>>
>> which would be equivalent to:
>>
>> sub delete_prices
>> {
>>      my $self = shift;        # Product
>>      my $price_id = shift;
>>
>>      my @keep = grep { $_->id ne $price_id } $self->prices;
>>      $self->prices(@keep);
>> }
>>
> 
> Yeah, there's no individual delete methods for ...-to-many
> relationships yet.  What you're written above amounts to a simple
> implementation of a "delete_on_save" method (but only if prices() is a
> "get_set_on_save" method; a real implementation wouldn't be able to
> rely on this).
> 
> Such things are on my (long) to-do list.

ok cool. I agree about the simplistic example code. Glad to know you at least 
have it on the to-do list, however long it may be.

For now I can keep doing:

  $product->prices( grep { $_->id ne $price_id } $product->prices );



> So, for a one-to-many relationship, the "find", "get_set_on_save", and
> "add_on_save" method types are created by default.
> 
> Finally, to find out what those methods will be called, look at the
> docs for the build_method_name_for_type() method.  Example:
> 
> http://search.cpan.org/dist/Rose-DB-Object/lib/Rose/DB/Object/Metadata/Relationship/OneToMany.pm#build_method_name_for_type
> 
> The loose coupling makes for a lot of flexibility, but it also makes
> for widely separated docs, I know.  Some sort of summary or overview
> would probably be handy, but I haven't gotten around to it.
> 

beautiful. exactly what I wanted. Sometimes my problem is relating my idea of 
what something is to what it is actually called in the docs; not knowing 
exactly 
what I should be looking for.

thanks, John.

pek

-- 
Peter Karman  .  http://peknet.com/  .  [EMAIL PROTECTED]

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