Hi,

On Sep 28, 2007, at 8:55 AM, Ian Docherty wrote:

MyCompany::MyApp::Controller
MyCompany::MyApp::View
MyCompany::MyApp::Model
MyCompany::MyApp::Schema (where my ORM goes)
MyCompany::MyApp::Logic (where my other business logic goes)

I originally created the 'Logic' namespace because I was using load_classes and by default my Schema directory had all my ORM result_source files.

However I am just in the process of changing to using load_namespaces so I now have

MyCompany::MyApp::Schema::Result (where I have moved all my result_sources to)
MyCompany::MyApp::Schema::ResultSet

I travelled the same path: I started with split Logic and Schema classes and move them all together with load_namespaces. It works fine, and thats the approach I recommend around here.

leaving  MyCompany::MyApp::Schema empty of classes.

So I presume I can consider the MyCompany::MyApp::Schema namespace to be for my business logic that does not directly map onto a ORM? (I can't think of a good example off-hand.)

I would defer that decision until you get a good example :)

One final point that I am not sure I have right.

In my business logic I have certain constraints (for example the maximum length of a web-form field, e.g. username) and most of the time this constraint is defined by the database (the field length of the user.username). Now the template needs access to these values to display the appropriate error message so typically I do the following in my controller.

You have attributes in the add_columns() to store all that. And if you do store them all in there, you can use DBIx::Class::Schema::deploy as a added bonus.

See:

* deploy: http://search.cpan.org/dist/DBIx-Class/lib/DBIx/Class/ Schema.pm#deploy * add_columns: http://search.cpan.org/dist/DBIx-Class/lib/DBIx/ Class/ResultSource.pm#add_columns

Best regards,
--
Pedro Melo
Blog: http://www.simplicidade.org/notes/
XMPP ID: [EMAIL PROTECTED]
Use XMPP!



_______________________________________________
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/

Reply via email to