2009年6月4日星期四

Re: [fw-mvc] get and set accessors

In terms of using interfaces, how should __get and __set be used? Should the interface require an implementation of the just the magic methods, or just the actual get* and set* methods, or both? Or should the magic methods be avoided when using interfaces in order to ensure a common interface?

-Hector


On Thu, Jun 4, 2009 at 7:37 AM, Ed Lazor <edlazor@internetarchitects.biz> wrote:
> This of course depends on how you implement it. I typically will throw a
> BadMethodCallException or InvalidArgumentException for methods I'm not
> trapping or if the property is one I'm not handling. In the
> implementations I've done, I only allow virtual getters/setters and
> __get/__set access for protected methods defined in the class, and throw
> an exception for any others.

Could you share a copy of your implementation?

-Ed


没有评论: