On 1/4/07, Tobias Kremer <[EMAIL PROTECTED]> wrote:
Zitat von Daniel McBrearty <[EMAIL PROTECTED]>:
> I want to add a new find method to one of my result classes ...
> now what can I call 'find' on in this class? How can I get at the resultset?
I suppose the correct way is to use the ResultSetManager component of
DBIx::Class and tag your method as a ResultSet. You can then call this method
on your ResultSet object. The POD has an example in thje Synopsis:
http://search.cpan.org/dist/DBIx-Class/lib/DBIx/Class/ResultSetManager.pm
As an alternative, you can also do the same thing manually without
ResultSetManager and the attribute, like:
Members.pm:
---------
package Engoi::Schema::EngoiDb::Members::ResultSet;
use base qw/DBIx::Class::ResultSet/;
sub find_by_name_or_email { .... }
package Engoi::Schema::EngoiDb::Members;
[ all of the normal code you pasted earlier ]
__PACKAGE__->resultset_class('Engoi::Schema::EngoiDb::Members::ResultSet');
1;
_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/