Searching members of class

2 messages Options
Embed this post
Permalink
steveo1999

Searching members of class

Reply Threaded More More options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)
I've been trying to learn Catalyst, but realize that I probably have to become more familiar with DBIC first.  Anyway, I'm trying to write a method in my 'Divisions' class of which one attribute is called 'divisionname'.  How can I write a sub called 'default' that will look in this table to find the one and only one record whose 'divisionname' is 'DEFAULT'?  FYI, I've successfully used this class to search the resultset, but don't see how to search within my own class.  

Thanks in advance.
Steve

BTW, I gave the Catalyst book a good review on Amazon, if that helps:)


_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@...
Rob Kinyon

Re: Searching members of class

Reply Threaded More More options
Print post
Permalink
On Fri, Aug 28, 2009 at 16:02, Steve<[hidden email]> wrote:
> I've been trying to learn Catalyst, but realize that I probably have to
> become more familiar with DBIC first.  Anyway, I'm trying to write a method
> in my 'Divisions' class of which one attribute is called 'divisionname'.
>  How can I write a sub called 'default' that will look in this table to find
> the one and only one record whose 'divisionname' is 'DEFAULT'?  FYI, I've
> successfully used this class to search the resultset, but don't see how to
> search within my own class.

Your "class" is actually the class of the row object. Rows cannot
search - they solely exist to allow manipulation of a row. You don't
get from the row back to the resultset. You want to add a method to
the resultset for that table.

Rob

_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@...