[Solar-talk] Changes afoot: a new Model class

Travis Swicegood development at domain51.com
Thu Feb 8 07:43:21 PST 2007


Note: I put this together yesterday shortly after the original post, but 
had some issues with my mail server...  Here they are again:

=== Original email ===

Well darn it... Thunderbird just ate my response.

Paul M Jones wrote:
> The idea is to start developing something along the lines of the Ruby- 
> on-Rails "ActiveRecord" class.

One of these days, I tell ya... I'm going to collect all of my
lamentations on RoR's "ActiveRecord" (as opposed to the "Active Record"
which is useful) and it'll be enough to change the tide.  I swear it :-)


> * Reads the schema from the database, creates the schema if it  
> doesn't exist, and keeps the schema in a cache if one is available  
> (to minimize database hits).  This means you won't need to define  
> $_col beforehand, you can just point the Model to a table and it will  
> get everything it needs.
>   

Couldn't in inflect this from the object name by default?  That's so
very convention over configuration.


> * Use of auto-increment instead of sequences (although this is a big  
> break from years of habit for me).
>   

I'd suggest trying to keep sequences around as an option.  Maybe throw
the nextId() type of method off to the DB which could be configured to
use either.



> This is for a couple of reasons, the main one being that PHP doesn't  
> support something called "late static binding".  Otherwise we'd be  
> able to a single Model class instead of Model/Record/RecordSet:  

Wouldn't a more proper naming convention be
Model/Meta/RecordSet|ModelList?  I might be a bit biased here, but it
seems like the Model should be the end-point, not the starting-point.
Otherwise it's not really a model but a Mapper with Meta data.

-Travis



More information about the solar-talk mailing list