Problem with outputting protected class data through h2o
Using the ORM framework found at: http://lukebaker.org/projects/activerecord-in-php/ I was unable to output data in the template because the model’s object’s "attributes" array (where it keeps its row data, accessed through a custom getter __get()) was protected.
In the PHP file, if I have a $user object, I can do print $user->username and it will output "bob", but if I display a template, with vars "user" => $user ... and then try to {{ user.username }} in template, nothing is output.
This ticket has 0 attachment(s).
Problem with outputting protected class data through h2o
Hello alex,
Thanks again for submitting this ticket, this isn’t really a bug of h2o template, but a issue with that ORM library you are using.
As i have demonstrated in this code paste which isset() php function will always return false on overloaded properties using magic method (__get()) unless (__isset()) is also implemented.
http://gist.github.com/76545
Here is the patch file to fix the problem for you and feel free to pass on the patch to the original author, at the mean time i will mark this ticket as invalid and feel free to contact me if u need help
please add this method to your activerecord.php
http://gist.github.com/76743
by Taylor luk
Problem with outputting protected class data through h2o
The library you were using contribute some of the problem where h2o also contains problem working with php overloaded objects since all magical object methods in php doesn’t return the variable reference (alias) by default.
Latest commit should fix this issue with updated specs.
https://github.com/speedmax/h2o-php/tree/5026bf372cb7fc93d9d477c17f0bb838ee2c5a87
by Taylor luk