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

_______________________________________________
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/[email protected]

Reply via email to