[jifty-devel] Inheritance of models declared in plugins
Ruslan Zakirov
ruz at bestpractical.com
Wed Jan 7 06:54:15 EST 2009
I wrote jifty plugin "Tag". Now, I try to use it in an app, however I
need a way to add column "disabled" to the Tag model and may be other
columns.
Mixins are cool for some sort of tasks, but for above problem mixins
don't help. What I want is proper inheritance: App::Model::Tag isa
Plugin::Tag::Model::Tag isa App::Model::Record isa Plugin::Tag::Record
(if it exists) isa Jifty::Record. So I can extend plugin in an app.
I think about Jifty::Class that will replace 'use base'. We have
pretty straight naming of class and can generate plenty of them, then
we can generate inheritance. Variants of usage I can think of:
package App::Model::Tag;
use Jifty::Class;
use Jifty::Record schema {
};
1;
Jifty::Class on import setups inheritance for the class.
I see that in some case you can reshuffle order, for example:
package App::Model::Tag;
use Jifty::Class qw(Something Jifty::Plugin::TagTranslated Jifty::Plugin::Tag);
use Jifty::Record schema {
};
1;
What do you think? Ideas?
--
Best regards, Ruslan.
More information about the jifty-devel
mailing list