interchange / TableEditor

25 stars 4 forks source link

API crash on ProductAttributes #14

Closed racke closed 10 years ago

racke commented 10 years ago

With Interchange6::Schema:

09/Mar/2014 21:54:03 [14001] error @0.010508> request to GET /api/ProductAttribute/list crashed: DBIx::Class::Relationship::Base::related_resultset(): No such relationship 'ProductAttributes' at /home/racke/interchange/TableEdit/lib/TableEdit/API.pm line 757 in /home/racke/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Dancer/Handler.pm l. 98

gregapompe commented 10 years ago

It's DBIx schema problem, but i can't figure out what it's causing it. ProductAttribute object doesn't have Product method for some reason (although it's specified in schema file).

I'll keep digging.

gregapompe commented 10 years ago

Problem is in name collision. We have two realations named Product.

PACKAGE->many_to_many("Product", "ProductAttributes", "Product"); This should be "Products" anyways. Change it to: PACKAGE->many_to_many("Products", "ProductAttributes", "Product");

The other is fine: PACKAGE->belongs_to( "Product", "Interchange6::Schema::Result::Product", { sku => "sku" }, { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, );

racke commented 10 years ago

Collision fixed in Interchange6::Schema now.

racke commented 10 years ago

Closing.