Private properties

I had a lot of trouble to extend classes with private attributes. May be it is a good idea to use protected ones instead.

It was discussed several times already and we’re generally agree with Symfony2 team on this matter http://fabien.potencier.org/article/47/pragmatism-over-theory-protected-vs-private If you have case when you absolutely can’t live with private members, post it as a bug and we’ll try to fix it.

Agree with samdark. Private properties are there for reason. If you have some specific case - it can be looked upon and decided to change the visibility if it is reasonable.

Making everything protected isn’t good because then people can extend classes the way they want and break internal framework API’s.

Moreover if everything will be protected, we, as core framework developers, wouldn’t have any chance to change internal things since it will break someone’s code. So either Yii will break BC every release or will be kinda stucked in terms of improvements.

One problem I ran into several times: I try to extend a class, to override a public or protected method but can’t, because the original method accesses some private members. Something I can’t do in my override. Of course, it’s not a problem as long as your override can call the parent’s implementation. But if you don’t want to do this - for whatever reasons - you’re stuck.

I don’t know a general solution for this, but maybe it’s worth to keep an eye on it. I’ll try to post an example if I come across such a problem again.