[Solar-talk] Changes afoot: a new Model class
Paul M Jones
pmjones at ciaweb.net
Wed Feb 7 15:37:00 PST 2007
On Feb 7, 2007, at 5:04 PM, Rodrigo Moraes wrote:
> On 2/7/07, Paul M Jones wrote:
>> The work is nowhere near complete, esp. when it comes to save() and
>> related objects, but it's good enough to start talking about and get
>> feedback on. Let me know what you think.
>
> Hey Paul,
> I'm amazed looking at the classes, and a bit sad because I spent the
> last week updating my models and forms relationships etc, but this
> sadness is for a good cause. :)
Yeah, I'm very very sorry to cause sadness. I hate breaking
stuff. :-( But this (very major) change is based on working with
Table/Row/Rowset for over a year in production environments, and it
encapsulates those experiences. I think the changes will be for the
better, even though painful.
And like I said, it's nowhere near done; it still needs a lot of
work. So your current tables/forms/etc are still needed in the mean
time. Hope that helps to ease the blow a bit.
> It was funny to see Solar_Inflect committed because a couple of days
> before, Andreas, Antti and I were discussing models and we three
> agreed (correct me if I'm wrong) that inflectors for singular/plural
> could be avoided; we were referring to Rails/Cake/these kind of
> inflectors; the idea would be to, let's say, use singular every time
> and forget to worry about converting to plural / maintaining this kind
> of code.
No, you're right, if there's some way to avoid it I'd like to. I've
seen similar conversations on the web about Rails and Cake and the
naming. There are options in place to let you pick the column names
and aliases, so if you want singulars or plurals, you can have them.
(At least that's the intent. :-)
Having said that, if you have a "to-many" relationship, it would make
sense to me that you'd ask for (say) $node->comments, not $node-
>comment. And if you have a "to-one" relationship, it seems that a
singular version makes sense ($node->area). So there has to be a way
to swap between the two in an automated way, so you're not required
to specify each time what the names should be.
Hope that helps to explain my intent, happy to hear more on the
inflection stuff.
--
Paul M. Jones <http://paul-m-jones.com>
Solar: Simple Object Library and Application Repository
for PHP5. <http://solarphp.com>
Join the Solar community wiki! <http://solarphp.org>
Savant: The simple, elegant, and powerful solution for
templates in PHP. <http://phpsavant.com>
More information about the solar-talk
mailing list