[Catalyst] FW: Inheriting existing CDBI model objects
Carl Vincent
C.A.Vincent at newcastle.ac.uk
Wed Mar 15 19:26:45 CET 2006
Following up my own message after more tinkering:
>I'm trying out Catalyst (5.66) for the first time.
>
>I've followed the example
>http://dev.catalyst.perl.org/wiki/MoviesScaffoldingDemoTranscript
>to create a scaffolded CRUD, and I'm using the method from the
>cookbook to wrap them in Catalyst::Model classes:
>
>The scaffolded system "kind of works" - list shows the right
>column headings, and the right number of "View Edit Destroy"
>links for the number of rows in the database. However it
>doesn't show any of the field values....
This behaviour happens with Catalyst::Enzyme (which was suggested on
#catalyst - so it looks like the scaffolding works just as well in this
case!)
>Outputing a Data::Dump shows the item passed in the stash to
>the view doesn't contain much:
>$VAR1 = bless( {
> 'person' => '189'
> }, 'ContactMgr::Model::Contact::Person' );
If I add a line in my model declaring all my columns as Essential,
Enzyme at least works (I've not tested the scaffold with this).
To summarize:
1. Existing CDBI object: all columns except PK declared as "Other".
2. Inherit from this in "normal perl", and column accessors work as
expected.
3. Inherit from this to make a Catalyst Model, column accessors return
undef.
4. Mark columns as essential in the derived Catalyst Model and accessors
work as expected.
So I have a workaround, but this behaviour is different to what I get if
I inherit my CDBI class outside of Catalyst... Is it just me doing
things in a weird way?
Cheers
Carl
More information about the Catalyst
mailing list