raelgc / template

PHP Template
http://raelcunha.com/template.php
GNU Lesser General Public License v2.1
73 stars 42 forks source link

Fix bug where object with protected class attributes and public getters and setters is not being converted. #1

Closed dufernandes closed 10 years ago

dufernandes commented 10 years ago

Whenever trying to read an object from an ORM, such as Doctrine, and protected attributes are used, the reading of their values fails, throwing an error. This is because the method property_exists is called, within the protected method subst, and it throws an error because it finds no public attributes. To avoid this issue, since public getters and setters are required when using protected class attributes, the first type of elements to be read should be public methods. This avoids this issue and that is what this patch does.