Ever look at something so long your eyes bleed?
I have a SKU object, with a relationship to object_attribute, like so:
relationships => [
object_attributes => {
type => 'one to many',
class => 'My::DB::ObjectAttribute',
manager_args => { require_objects => ['attribute'] },
column_map => { sku_id => 'oba_obj_id', version =>
'version' },
},
],
Now, each SKU has many object_attributes, but each SKU only has one
object attribute of any given attribute name. So, my ObjectAttribute
class has a relationship like so:
relationships => [
attribute => {
type => 'many to one',
class => 'My::DB::Attribute',
column_map => { oba_atr_id => 'atr_id', version =>
'version' },
},
],
What I'm trying to do, is given a SKU object and an attribute name,
return the corresponding ObjectAttribute. From my digging, it looks
like I should be able to do:
my $oa = $sku->object_attributes(query_args => ['attribute.atr_nm' =>
$attributeName ],
)->[0];
However, every time I run that, I get:
Can't locate object method "0" via package "My::DB::ObjectAttribute" at
/usr/lib/perl5/site_perl/5.8.8/Rose/DB/Object.pm line 1497
Rose::DB::Object::AUTOLOAD('My::DB::ObjectAttribute=HASH(0x92c5fe0)',
'query_args') called at /usr/lib/perl5/site_perl/5.8.8/Rose/Object.pm
line 25
Rose::Object::init('My::DB::ObjectAttribute=HASH(0x92c5fe0)', 0,
'query_args') called at /usr/lib/perl5/site_perl/5.8.8/Rose/Object.pm
line 13
Rose::Object::new('My::DB::ObjectAttribute', 0, 'query_args')
called at
/usr/lib/perl5/site_perl/5.8.8/Rose/DB/Object/MakeMethods/Generic.pm
line 5469
Rose::DB::Object::MakeMethods::Generic::__args_to_objects('My::SKU=HASH(
0x92daf54)', 'object_attributes', 'My::DB::ObjectAttribute',
'SCALAR(0x9138af8)', 'ARRAY(0x91385e8)') called at
/usr/lib/perl5/site_perl/5.8.8/Rose/DB/Object/MakeMethods/Generic.pm
line 3315
Rose::DB::Object::MakeMethods::Generic::__ANON__('undef',
'query_args', 'ARRAY(0x92e1298)') called at
/home/justintime/cvs/perllib/lib//My/DefaultObject.pm line 51
Buckle::BlueMartini::DefaultObject::getAttribute('My::SKU=HASH(0x92daf54
)', 'txt_ShortDesc') called at /home/justintime/tmp/roseTests.pl line 71
Now, I've decomplicated this a lot, to try and figure out what I'm doing
wrong, but can't find it. I even get the same error if I pass an empty
array ref with query_args.
Anyone have any tips?
Justin
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Rose-db-object mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rose-db-object