2008年7月29日星期二

Re: [fw-db] Custom Row Class - _get() from two tiers

SiCo007 wrote:
>
>
> Bill Karwin wrote:
>>
>> I would say this is too much magic...
>>
>
> Thanks Bill maybe you're right, would it be better to instantiate the
> variant model inside the product model or is this also a jumble of magic
> which is over the top?
>

Well, I'm not sure what your goal is, and why you need write this:
"$this->product->variant->col"
It seems to me that it's just as clear, and fewer keystrokes to write this:
"$this->product->variant_col"

Don't design your application around some innovative trick of code that no
one who uses the app will see.

If you need the product info and the variant info to be separate objects for
some reason of object-oriented design, then make them separate objects. You
may need a true Model class (i.e. not extending Table or Row) to contain the
logic and data for complex structured information.

Regards,
Bill Karwin
--
View this message in context: http://www.nabble.com/Custom-Row-Class---_get%28%29-from-two-tiers-tp18697512p18714387.html
Sent from the Zend DB mailing list archive at Nabble.com.

没有评论: