[Dbix-class] ISA Relationship

Nigel Metheringham Nigel.Metheringham at dev.intechnology.co.uk
Mon Aug 21 15:15:25 CEST 2006


On Mon, 2006-08-21 at 14:01 +0100, Sherwin D'Souza wrote:
> Is there relationships similar to Class::DBI::Relationship::IsA in
> DBIx, such that
> 
>   e.g.  Table: Window  columns (window_id title keywords) 
>                    CircleWindow   columns (window_id radius
> border_width)
> 
>           $circlewindow->radius; 
>           $circlewindow->title; 
>           $circlewindow->keywords;
> 

You could do
	CircleWindow->belongs_to(window_id => 'Window');

which would lead to
          $circlewindow->radius; 
          $circlewindow->window_id->title; 
          $circlewindow->window_id->keywords;

You could add methods to CircleWindow to pass title/keywords straight
through.

See
	DBIx::Class::Relationship
	DBIx::Class::Relationship::Base
and the manual.

	Nigel.

-- 
[ Nigel Metheringham           Nigel.Metheringham at InTechnology.co.uk ]
[ - Comments in this message are my own and not ITO opinion/policy - ]




More information about the Dbix-class mailing list