On 1/7/07 3:08 PM, Neal Clark wrote:
> I want to call get_objects on A::Manager with constraints for C, but I don't
> know how to setup that relationship in class A, or if it is even possible.
> i.e. I want to be able to say
>
> my $iterator = A::Manger->get_objects(
> query => [
> data => { regexp => 'blah' },
> b.data => { regexp => 'blah2' },
> c.data => { regexp => 'blah3' },
> ],
> require_objects => [ 'b','c' ],
> );
>
> but A::Manager can't require object C because there is no relationship setup
> for it.
You've got the right idea, but the wrong syntax. Try this:
$iterator =
A::Manger->get_objects(
require_objects => [ 'b.c' ],
query =>
[
'data' => { regexp => 'blah' },
'b.data' => { regexp => 'blah2' },
'b.c.data' => { regexp => 'blah3' },
]);
IOW, since you're making a call using the A manager and A is the primary
table, all related objects are addressed "starting from" a relationship in
A.
The chaining syntax is described in the get_objects() docs under the "query"
parameter:
http://search.cpan.org/dist/Rose-DB-Object/lib/Rose/DB/Object/Manager.pm#que
ry
Same deal for the require_objects parameter and docs.
-John
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Rose-db-object mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rose-db-object