[Dbix-class] Conditional Relationships

Matt S Trout dbix-class at trout.me.uk
Tue Jan 31 21:58:40 CET 2006

On Tue, Jan 31, 2006 at 03:39:38PM -0500, John Lifsey - Contractor - wrote:
> Is there a way to have conditional relationships?
> For instance in my case I have:
>    field_name, type_id, data_id
>    where the final table class to search for value (referenced by 
> data_id) is determined by type_id

Have a look at castaway's Anything code in BAST trunk.

> Also, is there a simple way to create accessor aliases?

__PACKAGE__->add_columns('foo' => { accessor => 'bar'}, ...);

DBIC will create a 'sub bar' instead of a 'sub foo' as accessor for the
'foo' column (only works on trunk/latest dev release though)

     Matt S Trout       Offering custom development, consultancy and support
  Technical Director    contracts for Catalyst, DBIx::Class and BAST. Contact
Shadowcat Systems Ltd.  mst (at) shadowcatsystems.co.uk for more information

 + Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +

More information about the Dbix-class mailing list