[CDBI] Searching using a might_have relationship.

Oliver Jeeves oj at defuturo.co.uk
Tue Oct 17 11:08:06 BST 2006

Ok, so I have two CDBI classes, with a might_have relationship between
them. Something like:

 package MyDB::A;
 use base 'MyDB';

 __PACKAGE__->columns->(Essential => qw(id this that));
 __PACKAGE__->might_have->(b => 'MyDB::B' => qw(other));

 package MyDB::B;
 use base 'MyDB';

 __PACKAGE__->columns(Essential => qw(id other));

I want to be able to search like this:

 MyDB::A->search(other => 'wibble');

Except that that doesn't work.

Basically, I want to use a value from a might_have relationship to
search, and I don't want to have to do multiple SQL queries to do it. Is
there an easy way to do this?


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
Url : http://lists.digitalcraftsmen.net/pipermail/classdbi/attachments/20061017/0c6842df/signature.pgp

More information about the ClassDBI mailing list