[Dbix-class] minimalistic Moose / DBIC glue module

piotr pogorzelski pp at webtel.pl
Wed Jun 23 12:57:21 GMT 2010


> I had thought in the past about where to separate the business logic.
> Do I do it in MyApp::Hotel or MyApp::Schema::Result::Hotel? Obviously
> canned queries go in MyApp::Schema::ResultSet::Hotel, but where's the
> dividing line between an operation on a Result object? What policies
> are other people using to determine this?
> 
>

I do business logic in MyApp::Model methods. they receive parameters
from MyApp::Catalyst::Controller::MyController, retrieve/store data
using MyApp::Schema and put result on stash as data hashrefs
to be used later in views.

I do not propagate MyApp::Schema::Result::Hotel objects
to views as I do not want to allow [% hotel.delete %] in view.

so model talks with database using DBIx::Class (or Rose or ..).
controller taks with model using data hashes (in/out)
view receives hashrefs with data to be displayed.

--
regards
piotr



More information about the DBIx-Class mailing list