[Catalyst-commits] r8623 - in
CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk: .
lib/CatalystX/CRUD/Model lib/CatalystX/CRUD/Object
karpet at dev.catalyst.perl.org
karpet at dev.catalyst.perl.org
Wed Nov 19 19:30:34 GMT 2008
Author: karpet
Date: 2008-11-19 19:30:34 +0000 (Wed, 19 Nov 2008)
New Revision: 8623
Modified:
CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk/Changes
CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk/lib/CatalystX/CRUD/Model/RDBO.pm
CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk/lib/CatalystX/CRUD/Object/RDBO.pm
Log:
add related_load_with feature
Modified: CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk/Changes
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk/Changes 2008-11-19 16:52:56 UTC (rev 8622)
+++ CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk/Changes 2008-11-19 19:30:34 UTC (rev 8623)
@@ -59,3 +59,6 @@
0.16 17 Nov 2008
* pass query if present in *_related() query methods
+0.17 xxx
+ * added related_load_with() feature and docs for it and load_with().
+
Modified: CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk/lib/CatalystX/CRUD/Model/RDBO.pm
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk/lib/CatalystX/CRUD/Model/RDBO.pm 2008-11-19 16:52:56 UTC (rev 8622)
+++ CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk/lib/CatalystX/CRUD/Model/RDBO.pm 2008-11-19 19:30:34 UTC (rev 8623)
@@ -7,9 +7,10 @@
use Carp;
use Data::Dump qw( dump );
-our $VERSION = '0.16';
+our $VERSION = '0.17';
-__PACKAGE__->mk_ro_accessors(qw( name manager treat_like_int load_with ));
+__PACKAGE__->mk_ro_accessors(
+ qw( name manager treat_like_int load_with related_load_with ));
__PACKAGE__->config( object_class => 'CatalystX::CRUD::Object::RDBO' );
=head1 NAME
@@ -21,10 +22,13 @@
package MyApp::Model::Foo;
use base qw( CatalystX::CRUD::Model::RDBO );
__PACKAGE__->config(
- name => 'My::RDBO::Foo',
- manager => 'My::RDBO::Foo::Manager',
- load_with => [qw( bar )],
- page_size => 50,
+ name => 'My::RDBO::Foo',
+ manager => 'My::RDBO::Foo::Manager',
+ load_with => [qw( bar )],
+ related_load_with => {
+ bars => ['doof']
+ },
+ page_size => 50,
);
1;
@@ -54,6 +58,19 @@
If there is no such module in your @INC path, then
the fall-back default is Rose::DB::Object::Manager.
+=head2 load_with
+
+The value of C<load_with> should be an array ref of relationship
+names. The array ref is passed into all the Manager
+get_objects* methods as the C<with_objects> value.
+
+=head2 related_load_with
+
+Similar to C<load_with>, but the C<with_objects> argument is passed
+in all the *_related methods. The C<related_load_with> value should
+be a hash ref with keys using relationships names and the values
+being array refs of relationship names in the foreign (related) classes.
+
=cut
=head2 Xsetup
@@ -291,6 +308,16 @@
push( @arg, $_ => $query->{$_} );
}
}
+ if ( $self->related_load_with
+ && exists $self->related_load_with->{$rel_name} )
+ {
+ push(
+ @arg,
+ with_objects => $self->related_load_with->{$rel_name},
+ multi_many_ok => 1
+ );
+ }
+ warn dump \@arg;
return @arg;
}
Modified: CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk/lib/CatalystX/CRUD/Object/RDBO.pm
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk/lib/CatalystX/CRUD/Object/RDBO.pm 2008-11-19 16:52:56 UTC (rev 8622)
+++ CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk/lib/CatalystX/CRUD/Object/RDBO.pm 2008-11-19 19:30:34 UTC (rev 8623)
@@ -3,7 +3,7 @@
use warnings;
use base qw( CatalystX::CRUD::Object );
-our $VERSION = '0.16';
+our $VERSION = '0.17';
=head1 NAME
More information about the Catalyst-commits
mailing list