On 9/18/2023 3:36 PM, Larry Garfield wrote:
I can see where you're going with this, but as others have noted I don't think
it's really the right way to go about it.
If the property hooks RFC passes (we're stalled a bit trying to put together
benchmarks, sorry), that will solve this use case in a much cleaner and more
generic way. (A property could be virtual, and backed by arbitrary logic to do
all the same streaming that you're talking about here.)
--Larry Garfield
Yes, property hooks <https://wiki.php.net/rfc/property-hooks> would be
perfect! I use that syntax all the time in C#, and love it. I vote for
that instead.
In the meantime, I will use Robert Lander's idea and create a helper
method, something like this:
<?= EchoCallable($model->body); ?>
Thanks for all your feedback everyone.
Regards,
Shailesh