Hello Matthias,
I'm not sure that it is either. It is mentioned a few times in the
online documentation. Being able to access member variables of an
object directly is not true OOP. However, OOP is only a concept and
many different programming languages implement it differently. Right
now, if you develope classes with PHP, you should provide accessor
methods for the properties that need to be accessed from outside.
This is not quite true - method type accessors are slow in PHP (as they involve a function call).
PHP is more like C# than Java - in theory you should use the overload extension if you want to implement setter/getters to implement future refactoring/ BC API stuff. (actually the plan is for DB_DataObjects to do this one day)
However it's not a totally clean line (sometimes setters/getters do still make sense.)
- however just putting in setters/getters for all variables when they dont need it is a little silly.
Regards
Alan
This
does not prevent the users of your class from accessing it's
properties directly. However, it allows you to rearange, rename, etc
anything you like inside your class in later releases as long as the
same interface is provided. This way, if the users of your class do
decide to access properties directly, they do so at their own risk.
I have not checked myself yet, but I have heard rumors that PHP5 is
going to be much more object oriented which could be a good thing.
We'll see.
Dan