Skip Menu |

This queue is for tickets about the DBIx-Class CPAN distribution.

Report information
The Basics
Id: 45813
Status: resolved
Priority: 0/
Queue: DBIx-Class

People
Owner: Nobody in particular
Requestors: alexmonney [...] hotmail.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.08010
Fixed in: 0.08108



Subject: update_or_create_related
update_or_create_related method seems to require the join column to be specified in the \%col_data argument eg product might_have price, simple join on price.product_id=product.id If the product has a price already, the following will create a new row in price table unless the product_id is explicitly stated in \%col_data $product->update_or_create_related( 'price', { price => $price, currency => $currency, product_id => $product->id }, );
On Thu May 07 07:37:49 2009, amonney wrote: Show quoted text
> update_or_create_related method seems to require the join column to be > specified in the \%col_data argument > > eg > > product might_have price, simple join on price.product_id=product.id > > If the product has a price already, the following will create a new row > in price table unless the product_id is explicitly stated in \%col_data > > $product->update_or_create_related( > 'price', > { price => $price, > currency => $currency, > product_id => $product->id }, > );
A quick glance over this, and the problem seems to be that something in the find path isn't recognizing that the PK is there because its not passed in directly in the hash, but instead merged in from the join/related resultset.
On Thu May 07 07:37:49 2009, amonney wrote: Show quoted text
> update_or_create_related method seems to require the join column to be > specified in the \%col_data argument > > eg > > product might_have price, simple join on price.product_id=product.id > > If the product has a price already, the following will create a new row > in price table unless the product_id is explicitly stated in \%col_data > > $product->update_or_create_related( > 'price', > { price => $price, > currency => $currency, > product_id => $product->id }, > );
Broken in lists 0.08010, not 0.08100+. Is this bug present in the latest versions?
Stalling while waiting on test case.
re-open to differentiate from real stalls
On Thu May 07 07:37:49 2009, amonney wrote: Show quoted text
> update_or_create_related method seems to require the join column to be > specified in the \%col_data argument > > eg > > product might_have price, simple join on price.product_id=product.id > > If the product has a price already, the following will create a new row > in price table unless the product_id is explicitly stated in \%col_data > > $product->update_or_create_related( > 'price', > { price => $price, > currency => $currency, > product_id => $product->id }, > );
Resolved by http://dev.catalyst.perl.org/svnweb/bast/revision/?rev=6781