On 10/28/07, John Siracusa <[EMAIL PROTECTED]> wrote:
> On 10/28/07 9:03 PM, Arshavir Grigorian wrote:
> > I have a many-to-many relationship. When I insert a new record in the
> > mapping table, while also inserting a new record one of the end
> > tables, I would like to set a certain value in the  mapping table.
>
> Many-to-many relationships exist as a convenient way to ignore the "middle"
> (mapping) table and get right to the "leaf" table.  Once you want to
> manually alter the mapping table, what you're really looking at is two
> separate relationships: a one-to-many to the mapping class followed by a
> many-to-one relationship in the mapping class itself to the "leaf" class.
>
> This thread discusses a few other possibilities:
>
> http://www.mail-archive.com/rose-db-object@lists.sourceforge.net/msg01329.ht
> ml
>

Thanks.

> > Also, I am using t2s() to add the mapping for $t2_id, but the mapping
> > record for $t1 are not deleted first  before the new one is added.
>
> Are you using an "add" method or setting the whole list using a
> "get_set_on_save" method?
>
> -John

I am using the syntax that you used in the docs :

$p = Product->new(id => 123)->load;

$p->colors({ name => 'pink'   },
                { name => 'orange' });

# Delete old rows in the mapping table and create new ones
$p->save;

I am definitely not using the add_colors() method. Not sure if
get_set_on_save()  is called in the background.

Arsh

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to