[Catalyst] Adding relationships to loaded CDBI models

Christopher Heschong chris at wiw.org
Thu Jun 16 19:15:52 CEST 2005


So a model based on Catalyst::Model::CDBI loads up all my tables and
columns, sweet.

But then how do I extend one of those auto-generated classes with extra
relationships.

For instance, in my MyApp::M::CDBI I would like to do this:


package MyApp::M::CDBI;
use base 'Catalyst::Model::CDBI';
__PACKAGE__->config( ... );

MyApp::M::CDBI::Table->has_a (
	date	=> 'Class::Date',
	inflate	=> 'new',
	deflate	=> 'epoch'
);

1;


But at the time that MyApp::M::CDBI is loaded, the MyApp::M::CDBI::Table
class doesn't exist yet.  I could use Catalyst::Model::CDBI::Plain and
define everything myself, but is there any way to take the ease of
C::M::CDBI and extend it a little?

Thanks again.




More information about the Catalyst mailing list