[CDBI] How to Query Relationships programatically?

Bill Moseley moseley at hank.org
Sun Mar 11 16:09:43 GMT 2007


On Sun, Mar 11, 2007 at 06:33:43AM +0000, Praveen Hombaiah wrote:
> Hi,
>   Is there a way to programatically find out the relationships a class
> has?  i.e. are there methods which can tell what other classes a given class
> has relationships with and the nature of the relationship( has_a, has_many
> etc )

It's stored in the class' meta_info hash.

Try dumping it:

    print Dumper My::CDBI::Class->meta_info;

or for just the has_many relationships, for example:

    print Dumper My::CDBI::Class->meta_info( 'has_many' );


-- 
Bill Moseley
moseley at hank.org




More information about the ClassDBI mailing list