Quote from: BobRay at Nov 24, 2010, 04:09 PM
Nice.
BTW, isn’t this a bit oxymoronic with respect to naming conventions? 
public $_relatedObjects= array ();
Thanks for pointing this out actually...
If you follow PEAR standards maybe, but using this technique here allows me to avoid using up class member names that might actually be column names in a table and therefore might need to be aliased as an object member (i.e. xPDO::OPT_HYDRATE_FIELDS is set to true). And tbh, I really wanted it to be protected, IOW, I wanted other core classes in the core of the framework to be able to access this data directly without making it public, but this is not possible in PHP since there is no concept of a package to provide protected access to. All protected gets you in PHP is access in derivative classes, and this leads to many inaccuracies in the intentions of the code here. I will say that a general rule of thumb is if it is public and starts with an _, then it is likely intended to be protected; IOW it should only be directly accessed from classes in the package which in this case is the core
om package. Of course, this is not always the case. For example, public static _loadInstance is now intended to be public, it just started out as private in code that is used in MODx and needs to be aliased as loadInstance() while _loadInstance() is deprecated for a release or two.
Regardless, this is something I can address in documentation for clarification, and in code via consistency to that documentation.
So no, it is done on purpose, so it can be accessed from other classes in the package; it is protected at heart. The _ naming convention == private thing IMO is an arbitrary barrier placed on implementation (leftover from when PHP had no concept of method/member scope); arbitrary in that prevents the full-potential of practical PHP applications from being realized in some cases in trade for ideals.