[thelist] PHP object property getters/setters

Andrew Kamm akamm at demicooper.com
Thu Dec 1 09:24:33 CST 2005

On 11/30/05 2:41 PM, "Matt Warden" <mwarden at gmail.com> wrote:

> Have you tried, maybe:
> {$cust->getState()}->stateName

I just tried that and it didn't work (in quotes it prints something like
"Object 3->stateName", out of quotes it throws an error because of the {}).

> Otherwise, I would probably just drop the use of accessors and mutators,
> unless there is a case where it is necessary.

Indeed. It looks like (for me) the best way to go is to use getter/setter
methods for properties that are not objects, and to set properties that are
objects to be publicly accessible.  That will at least reduce the properties
that can be accidentally overwritten.

thanks everyone for the help --


More information about the thelist mailing list