On Mon, Sep 17 2012, Karl Forner <karl.for...@gmail.com> wrote:

> The goal is to provide dynamic columns to dbix result objects.
[...]
> To be more concrete, suppose that you have User table, with a foreign
> key user_type_id on a UserType table (a lookup table).
> You'd like your nice extjs grid automatically filled thanks to
> CatalystX::ExtJS::REST to display a user_type column, because the
> "user_type_id" column is not veru useful for your customers.
> 
> Using DBICx::DynamicColumns, you could tie the (new) method/column "type"
> to $row->user_type()->name() for instance.

isn't that exactly what you do with the 'proxy' attribute? see

https://metacpan.org/module/DBIx::Class::Relationship::Base#attributes

so in your User table, you would define the relationship like this:

--8<-------------------------------------------------------------------

__PACKAGE__->belongs_to(
    "user_type",
    "Your::Schema::Result::UserType",
    { user_type_id => "user_type_id" },
    {
        proxy => {
            type => 'name',
        },
    },
);

--8<-------------------------------------------------------------------

not sure though about your other intentions with the dynamic columns
class.

    patrick

-- 
Patrick Meidl ........................ patr...@pantheon.at
Vienna, Austria ...................... http://gplus.to/pmeidl


_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk

Reply via email to