[Solar-talk] The new model class discussion, some questions

Antti Holvikari anttih at gmail.com
Mon Feb 19 12:23:46 PST 2007


On 2/19/07, Paul M Jones <pmjones at ciaweb.net> wrote:
> > Yes, the record suddenly turns into a swiss army knife
> > because of the shift of context for the find() et.al, but the
> > methodology is very capable.
>
> It is this shift in context that makes me unhappy.  :-(  To me, the
> object should represent the same class of thing all the time, not
> switch what it represents depending on context.

I can't say much about AR and ORM designs since I haven't used them at
all. But it is that *exact* same reason as Paul mentions above that
bothers me too. As I mentioned on #solarphp, it makes perfect sense to
me that a model (table object) represents *many* records while a
record (or a row) object represents *one* record.

Andreas wrote:
>> If you
>> keep the current implementation, then at least make it
>> possible/easy/sane to subclass the Record class so I can add my
>> precious domain logic and reuse them other places in my application :)

This is something I don't quite understand. Could someone explain to
me why is it neccessary or better to have business logic in the record
itself rather than in the model object.


> 1. I very much dislike the context-switching used in DB_DO, et. al.
>
> 2. However, I see your point about record-based vs table-based, esp.
> with respect to keeping logic in one place, and it's worth exploring.
>
> As such, I might attempt an experimental revamp of the experimental
> Solar_Sql_Model/Record/RecordSet classes to see if I can come up with
> something closer to what you're talking about, as it seems like
> Rodrigo et al are also interested in that mode of working.  Can't
> promise anything though.  Before I do so: how many of you really
> think the record-based approach is a better idea than table based for
> most (80% or more) of common real-world cases?

I have yet to be convinced to the record-based approach. The table
stuff seems more sane to me, at least for now. I'd like to hear more
opinions about this. Any Zend guys near by?

-- 
Antti Holvikari <http://phphalo.com>


More information about the solar-talk mailing list