[Dbix-class] adding methods to result class
Daniel McBrearty
danielmcbrearty at gmail.com
Thu Jan 4 14:12:11 GMT 2007
Hi
I want to add a new find method to one of my result classes ...
package Engoi::Schema::EngoiDb::Members;
use strict;
use warnings;
use base 'DBIx::Class';
__PACKAGE__->load_components("PK::Auto", "Core");
__PACKAGE__->table("members");
__PACKAGE__->add_columns( qw / username email .... / );
__PACKAGE__->set_primary_key("username");
__PACKAGE__->add_unique_constraint("members_username_key", ["username"]);
__PACKAGE__->add_unique_constraint("members_email", ["email"]);
.
.
.
# try to find a member by name, if that fails try email, otherwise return 0
sub find_by_name_or_email {
my ($self, $name_or_email) = @_;
}
now what can I call 'find' on in this class? How can I get at the resultset?
--
Daniel McBrearty
email : danielmcbrearty at gmail.com
www.engoi.com : the multi - language vocab trainer
BTW : 0873928131
More information about the Dbix-class
mailing list