I am trying to print an object's property on my template:
{{ MyObject.itsProperty }}
The thing is, this property is not set, __isset will return false and __get will return null.
Instead of printing nothing and leave it at that, Twig tries to print MyObject which causes an error:
Recoverable fatal error: Object of class MyObject could not be converted to string in .....vendor/twig/twig/lib/Twig/Environment.php(378) : eval()'d code on line 54
Setting strict_variables to false didn't help. How to deal with it?
__toString()for the object and have it return an empty string... - TheGentleman{{ MyObject.itsProperty|default('') }}? - PaulMyObjecthave a__call()method? Twig will try that too when trying to resolve a dot operator. - TheGentleman