[Catalyst] Catalyst::Model::DBIC::Schema and result classes
Richard Jolly
Richard.Jolly at bbc.co.uk
Thu Mar 30 11:56:50 CEST 2006
Hi,
I'm trying to get started with C::M::DBIC::Schema. I have an existing
schema defined, but C::M::DBIC::Schema does not seem to be picking up
custom result_classes .
The schema is defined like:
PIP::Schema;
PIP::Schema::Pip # source/table definitions
PIP::ResultSet::Pip # custom resultset classes
PIP::Pip # result class additional methods
(there is more of course, but in the same pattern)
The catalyst app looks like:
Pips3::M::PIP; # C::M::DBIC::Schema
No other classes are defined under M.
The error I'm getting is:
"Can't locate object method "ce" via package "Pips3::M::PIP::Pip"
where ce is definded in PIP::Pip, and the call in the controller looks
like:
my $obj = $c->model('PIP::Pip')->find($id)->ce;
In the debugger:
DB<12> x ref $c->model('PIP')
0 'Pips3::M::PIP'
DB<8> x ref $c->model('PIP::Pip')
0 'PIP::ResultSet::Pip' # looks good
DB<9> x $c->model('PIP')->class('Pip')
0 'Pips3::M::PIP::Pip' # I would expect
PIP::Pip here
So where does Pips3::M::PIP::Pip come from?
I tried making a minimal Pips3::M::PIP::Pip package:
package Pips3::M::PIP::Pip;
use base qw/PIP::Pip/;
1;
But that gives me a C3 merge error:
"Inconsistent hierarchy found while merging 'Pips3::M::PIP::Pip':
current merge results [
Pips3::M::PIP::Pip
]
merging failed on 'PIP::Schema::Pip'"
I CAN get around this by changing use base to unshift @ISA, but that
doesn't feel right.
So - where have I gone wrong, and how should I resolve it?
Thanks,
Richard
http://www.bbc.co.uk/
This e-mail (and any attachments) is confidential and may contain
personal views which are not the views of the BBC unless specifically
stated.
If you have received it in error, please delete it from your system.
Do not use, copy or disclose the information in any way nor act in
reliance on it and notify the sender immediately. Please note that the
BBC monitors e-mails sent or received.
Further communication will signify your consent to this.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rawmode.org/pipermail/catalyst/attachments/20060330/cce57be8/attachment.htm
More information about the Catalyst
mailing list