[Catalyst] Relational DB with Catalyst

Matt S Trout dbix-class at trout.me.uk
Tue Sep 27 00:55:11 CEST 2005


On Mon, Sep 26, 2005 at 11:04:17AM -0700, Will Smith wrote:
> I have a db of  2 tables :book, author
> create table author (
> authorID INTEGER PRIMARY KEY,
> name TEXT,
> phone TEXT
> );
>  
> create table book (
> bookID INTEGER PRIMARY KEY,
> description TET,
> authorID INTEGER REFERENCES author
> );
>  
> I use the Scaffold class to create TT, Model, and Controller for this. I can edit,add,delete data by accessing each class. 
> Question: How can I make a view of authors and books?

Assuming you've got a has_many relationship set up from authors to books,
you should be able to get an array of book objects  by calling ->books
on an author object.

-- 
     Matt S Trout       Specialists in perl consulting, web development, and
  Technical Director    UNIX/Linux systems architecture and automation. Mail
Shadowcat Systems Ltd.  mst (at) shadowcatsystems.co.uk for more information

 + Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +



More information about the Catalyst mailing list