Jira issue originally created by user romanb:
The reasoning is simple: The prefix "_" is usually either used for easier distinction of instance variables from other, i.e. local variables, instead of always using "this." (often seen in C#), or it is used to signal that a member is not meant to be accessed from outside of the class when the language does not have visibility modifiers (PHP4).
Since you always have to use "$this->" in PHP5+ when accessing instance members and there are visibility modifiers, the "_" is largely superfluous and just makes the verbose OO code even more verbose.
Maybe the following find/replace steps will do the job almost completely:
"private $_" => "private $"
"protected $_" => "protected $"
"$this->_" => "$this->"
Comment created by @beberlei:
i just found a possible BC issue with this.
EntityRepository is allowed to be extended by us, it has several variables that are underscore prefixed. How to proceed in this case?
Comment created by romanb:
I know but its not really a problem I think. We should just decide whether we make them private in the first place and provide getters instead (which would have avoided this problem in the first place).
Leaving the prefixes on the repository class only is also an option... but I dont think thats necessary.
can we commit getters for Beta 1 then? We could give everyone a period until Beta 2 to fix their code and then make the change.
EntityRepository is the only class that is meant to be userland extendable to my knowledge, so this should be the only problem to adress
Yes, you can add getters and commit right away if you want. Plus adding a note on the upgrade document that direct access of these properties is deprecated.
Persisters will be also extensible some day in userland but they need more polish for that, I've already started with it :)
Comment created by johnnypeck:
Is this still planned? Searching the code base finds this is not being implemented. It would be a good idea to implement the change sooner than later if it will be done at all. Also, +1 for the change. It makes complete sense.
Comment created by @guilhermeblanco:
Moving to 3.0 as this can potentially create BC breaks