Is there a way in DBIC to alias column names? I know I can specify an
accessor name (and create wrapper accessors using different names), but I'm
looking for a way to alias column names to use both as accessors and when
calling create().
The deal is I already have a Catalyst app with a DBIx::Class model. I'm
adding some API functionality but the specifications require using new names
for some of the column data. So, in the same app I need to be able to do
$schema->resultset( 'Cd' )->create({
name => 'Frampton Comes Alive',
artist => $artist,
});
And
$schema->resultset( 'Cd' )->create({
ttitle => 'Frampton Comes Alive',
author => $artist,
});
And likewise, these are the same:
$title = $cd->title;
$title = $cd->name;
as well as these has-many relationships:
$tracks = $cd->tracks;
$tracks = $cd->songs;
--
Bill Moseley
[email protected]
_______________________________________________
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/[email protected]