On 10/26/05, Dave Howorth <[EMAIL PROTECTED]> wrote:
> On Wed, 2005-10-26 at 17:04 +0100, David Baird wrote:
> > I can see what you're getting at, but until Maypole has a more advanced
> > configuration framework, it does seem to make sense to me to use the
> > driver precisely as the catch-all.
>
> My worry is that Maypole has a lot of baggage that we'd like to
> rearrange to be able to simplify understanding and to enhance features.
> A number of recent changes seem to me to just add more bags to the pile.
>
> If we're going to add new features like model type configuration, I'd
> rather add them where they belong - like Peter's original proposal.
>
I've been thinking about a model config hash accessor for all this
stuff. Not sure how to implement it but you could say stuff like:
$r->model_class->config(...); # global stuff
$beer->config->display_columns( qw/.../); # individual stuff
$beer->config->column_type( { ...});
IMO -- Column type is an application specific thing a lot of times.
For example, I have to different businesses with the same database.
They can essentially use the same model classes. One thing is that
one business caters to "Beer Brewers" and one caters to "Beer
Drinkers" . They both cater to "Dogs" ; (???? )
Ok so for the Customer::type column I have a varchar(50);
But it is really treated as an enum.
So for one app i have to set the enum string differently in my column_type sub;
Customer::column_type {
return "Enum ('Dog', 'Beer Drinker') if $col eq 'type';
return SUPER::column_type($col);
}
and
Customer::column_type {
return "Enum ('Dog', 'Beer Brewer') if $col eq 'type';
return Super:;column_type($col);
}
I have littered my models with this every where in the my app and it
is defeating the purpose of my general DB schema.
For this reason I have no qualms about putting this in the app config.
$r->config->customer->column_type->{type} = "ENUM('Dog', 'Beer Brewer')";
However, I would still want Models to be able to trump this as
Ultimately it is a Model Config. Therefore, currently I would use the
column_type interface or whatever you settled on for accessing and
have it access the app config by default.
*** Would it be cool if each table had its own config object and this
was stored in $r?
So $r->config->customer would return the object much like maypole
config? And you could initialize it via the Model package definition
or in the appilaction?
Cheers
--
pjs
-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
_______________________________________________
Maypole-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/maypole-users