FAQ
Hi,



I recently upgraded the DBIx::Class::Schema::Loader module (from ??? to
0.05003), and found that it broke a previously-working syntax, of
following a foreign key to another table. For instance, in the Catalyst
Perl sub, I do "$c->stash->{builds} = [$c->model('DB::Build')->all];"



Then, on the page (a TT page), I had a FOREACH loop "[% FOREACH build IN
builds -%]", and inside it, printed out various values for each of the
builds (server, version, source path, etc); one of these was a foreign
key to an "environment" table, which has columns for "name" and
"buildstring"; that line used to look like:



<td>[% build.environment_id.name %] ([%
build.environment_id.buildstring %])</td>



However, that syntax is no longer working; now I need to send the
environment in a separate $c->stash call (and in several other places,
in the Perl code, I have had to change it to do a lookup on the
intermediate table first, then get the value-the multiple "->" no longer
work).



I realize this isn't strictly a Catalyst issue, but I do recall seeing a
suggestion on the list to upgrade that module to fix something else (I
think it was autocrud issues I was experiencing)-and now that it's
breaking this very useful syntax, I'm wondering:



a. if there's a way to bring it back easily (like adding some qw
to the "use" line?);

b. if I should revert to the working version (or some version in
between what I previously had (how do I determine that, after the
upgrade has already happened?), which fixes the autocrud issues but
doesn't break the "multiple '->'" usefulness); and

c. if there's perhaps some other solution?



For now, the solution I've used seems kludgey; I added to the Perl sub
this line: "$c->stash->{environments} =
$c->model('DB::Environment')->all;". And, instead of the one-liner
above in the TT, I now do 3 lines:



[% envid = build.environment_id -%]

[% env = environments.$envid -%]

<td>[% env.name %] ([% env.buildstring %])</td>



Thanks,

--
Ken Beal
Senior Software Engineer, Build/Release

Cross Country Automotive Services
One Cabot Road
Medford, MA 02155
p: (781) 306-3605
m: (978) 423-8977
e: kbeal@crosscountry-auto.com


Confidentiality Note: This e-mail message and any attachments may contain
confidential or privileged information. If you are not the intended recipient,
please notify me immediately by replying to this message and destroy all
copies of this message and any attachments. Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20100609/0dff9bfe/attachment.htm

Search Discussions

  • Drew Taylor at Jun 10, 2010 at 11:00 am

    On Wed, Jun 9, 2010 at 5:08 PM, Ken Beal wrote:

    I recently upgraded the DBIx::Class::Schema::Loader module (from ??? to
    0.05003), and found that it broke a previously-working syntax, of following
    a foreign key to another table. For instance, in the Catalyst Perl sub, I
    do “$c->stash->{builds} = [$c->model('DB::Build')->all];�
    FYI, the latest version of Schema::Loader is now 0.07. It generates some
    very nice looking Result classes. Perhaps you should first upgrade to this
    version?

    Drew
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20100610/91e9379e/attachment.htm
  • Rafael Kitover at Jun 10, 2010 at 11:34 pm

    On Wed, Jun 09, 2010 at 12:08:33PM -0400, Ken Beal wrote:
    Then, on the page (a TT page), I had a FOREACH loop "[% FOREACH build IN
    builds -%]", and inside it, printed out various values for each of the
    builds (server, version, source path, etc); one of these was a foreign
    key to an "environment" table, which has columns for "name" and
    "buildstring"; that line used to look like:



    <td>[% build.environment_id.name %] ([%
    build.environment_id.buildstring %])</td>
    Now it would be:

    [% build.environment.name %]

    Look at your Result classes for the relationship names.

    If you want the old names, pass the naming=v4 option (after
    create=static on the helper command line.)

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcatalyst @
categoriescatalyst, perl
postedJun 9, '10 at 4:08p
activeJun 10, '10 at 11:34p
posts3
users3
websitecatalystframework.org
irc#catalyst

People

Translate

site design / logo © 2021 Grokbase