John Goulah wrote:
I am having some trouble in both controller and template code accessing resultset functions off of chained/related objects (because from what I'm seeing they are not ResultSets but of the type MyApp::Model::MyAppDB::Tablename).
For example I can create a ResultSet object directly like:
    my $owner = $c->model('MyDB::User')->search({ user_id => $owner_id } );

and then I can do for example:

    $owner->some_result_set_method()

but I can't do this if I want to chain off another object, such as:

    #not ok
my $owner_id = $photo_details_rs->first()->owner->some_result_set_method();
but...

    #this is fine, just accessing a field
my $owner_id = $photo_details_rs->first()->owner->user_id; and if I have some relation such as 'primary_photo' defined, then in my template this is also ok on this model type object:

       comment.user.primary_photo.asset.url

but if I wanted to call a method defined in my ResultSet, its not working:

    comment.user.some_result_set_method
I understand this is because comment.user is of type Model, but it seems there would be some way to call these functions since in this case I need to get at the user object from each comment since thats whats being iterated-

Thanks,
John


Wrong list entirely. You are asking what appears to be a DBIx::Class question: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class

_______________________________________________
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/

Reply via email to