[Dbix-class] Catalyst::Model::DBIC::Schema
Brandon Black
blblack at gmail.com
Wed Feb 8 20:56:08 CET 2006
On 2/8/06, Alan Humphrey <alan.humphrey at comcast.net> wrote:
> is this even necessary? Catalyst seems to be able to find my DBIx schema
> stuff just fine with nothing special aside from the location of the files.
> Or am I taking advantage of an undocumented feature/bug?
As I noted much later in the same email:
(actually, it just mostly works if you stick your schema class
definitions in MyApp/Model/, although sometimes are less convenient
than they should be, IIRC)
Although there's an obvious grammatical error there, I think I mean
"some methods" when I said "sometimes".
So no, none of it is strictly neccesary. If you want to just stuff a
Schema class with its associated classes and whatnot directly into
MyApp/Model/, you can, and it will work (for some values of "work").
The issues you'll face are:
1) Having to stuff ACCEPT_CONTEXT hooks in somewhere manually if you
want to use shortcuts like $c->model('Foo::Bar') to reach resultsets.
2) If someone decides to deploy multiple instances of your Catalyst
application on the same mod_perl server, they can't have seperate
connections, since you're setting the connection data in the hybrid
schema/model class itself.
3) Your Schema is now packaged with your Cat app, which for some
people isn't a good thing (like in cases where the Cat app is merely a
web-front-end, and there is lots of non-Catalyst application code
which also likes to use the Schema, and which might not even reside on
the same machine as your Catalyst webserver, etc).
Catalyst::Model::DBIC::Schema is designed to overcome these problems
in a quick/simple way for the user.
-- Brandon
More information about the Dbix-class
mailing list