[Catalyst] Some guidance needed please
Matt S Trout
dbix-class at trout.me.uk
Thu Sep 13 19:11:49 GMT 2007
On Thu, Sep 13, 2007 at 05:50:21PM +0100, Simon Wilcox wrote:
> Matt S Trout wrote:
> >On Thu, Sep 13, 2007 at 03:14:58PM +0100, Ian Docherty wrote:
> >>Almost, if I do my $used_password =
> >>it works. So that should do for now, thanks Simon and Will for your help
> >No. Don't do that.
> >Really don't.
> >It's utterly broken.
> Thanks. I'm not as familiar with the interaction of DBIx::Class and
> Catalyst::Model::* as you are (obviously, I didn't write 'em :) but from
> I find:
> Arguments: $result_class?
> Return Value: $result_class
> An accessor for the class to use when creating row objects.
> to result_source->result_class - which in most cases is the name of
> the "table" class.
> This seems to be the right behaviour to me. Can you summarise why it is
> not ?
No, result_class behaves perfectly.
Trying to create a record via a class method is WRONG. This is not Class::DBI.
Don't do it.
Collection methods should go on resultset objects. Always.
Class method stuff will easily break in all sorts of fun ways because DBIC
isn't designed to work like that.
> So would the original be better written as:
> $c->model('DBIC::UsedPassword')->class->create_limited(); # ?
> If it's not this then the docs are really confusing and I'd really
> appreciate it if you could provide the correct usage or approach for
> this situation.
The docs are correct.
That's just completely the wrong place for the create_limited method.
Matt S Trout Need help with your Catalyst or DBIx::Class project?
Technical Director Want a managed development or deployment platform?
Shadowcat Systems Ltd. Contact mst (at) shadowcatsystems.co.uk for a quote
More information about the Catalyst