Hi everybody,

I'm writing a forum application with DBIx::Class and Catalyst. Every post in a
forum is stored using two tables (for performance reasons):

  * posts - (DBIC class "Forum::Post")
    contains basic data for every post
    has_one relationship with Forum::PostText

  * post_texts - (DBIC class "Forum::PostText")
    contains just the texts
    belongs_to Forum::Post

I'm wondering what's the best way to encapsulate this because I don't want to
make calls to several DBIx::Class classes everywhere I want to insert a new
post (i.e. in Catalyst controllers). Should I just create a third class outside
the Schema namespace which utilizes all neccessary DBIx::Class classes for
inserting a new post to hide the underlying separation into two tables from
the rest of the application? What I want is to call _ONE_ method in my
Catalyst controllers to insert a new post into the database. The controller
shouldn't worry if the data gets stored in one, two or ten tables.

Maybe there's some sort of DBIx::Class magic to do this without having to
add an extra layer myself?

Thanks for any suggestions!

--Tobias

_______________________________________________
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/dbix-class@lists.rawmode.org/

Reply via email to