Outstanding! That's what I was looking for. I remembered seeing it
somewhere, but didn't know where :)
Thanks Dermot!
- Fagzal
On 27 October 2011 12:26, Csongor Fagyal<[email protected]> wrote:
Hi,
Hello Fragzal,
a Result basicly represents a single row, while ResultSet is an object which
represents a database query.
Your should put your confirmAndGetUser method into
MyApp::Schema::ResultSet::User, like:
package MyApp::Schema::Result::User;
use Moose;
BEGIN { extends 'DBIx::Class::ResultSet'; }
sub confirmAndGetUser {
my ($self, $code) = @_;
return $self->find({ code => $code });
}
....
and than within your Controller: my $result =
$c->model('DB::User')->confirmAndGetUser($code);
I don't really follow you.
I have generated the models with the helper script, and it generated a
MyApp::Model::DB for me, which extends Catalyst::Model::DBIC::Schema, and
also MyApp::Schema::Result::User, which extends DBIx::Class::Core:
--------
package MyApp::Schema::Result::User;
use utf8;
use Digest::MD5 qw/md5_hex/;
use Moose;
# Created by DBIx::Class::Schema::Loader
# DO NOT MODIFY THE FIRST PART OF THIS FILE
use strict;
use warnings;
use base 'DBIx::Class::Core';
---------
I don't have a MyApp::Schema::ResultSet::User. So... now what? :)
You have to manually create that directory and the class. Have a look here:
http://search.cpan.org/~hkclark/Catalyst-Manual-5.9002/lib/Catalyst/Manual/Tutorial/04_BasicCRUD.pod#Create_a_ResultSet_Class
Hth,
Dermot
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/