Bug
Data property with value null not working in twig
Issue description
A tobject that has a data property with the name "price" having the value null. When using this property, e.g. order.price in twig and comparison other than "is defined" fails with the error message: failed method call on tobject: Bad method label 'price(...)'.
Developer comments
This might be caused by a faulty implementation of __isset. It is uses %isset% instead of %array_key_exists%.
Hmm. The use of isset might have some significance. Nightly tests might bring some light into this mystery.
array\_key\_exists works better, but when the property is absent, the error message is still misleading.
A switch to array\_key\_exists would cause other problems since all off the sudden data property with a null value would return true when passed to isset. An valid expression like the following
[%isset($invoice->date) ? $invoice->date->format("d.m.Y") : "Open" %]
would fail, as it will evaluate the middle part, but $invoice-\>payment_date is null.
The monkey patching of the twig template was faulty. It did not consider that the class of a tobject is not "Tobject" when it is in a domain class, but rather the domain class. Works now. Added extensive tests.
|
Work sessions3
Start |
2023-12-01T07:10:19
|
End |
2023-12-01T07:43:33
|
Participant |
Robert Cerny
|
Start |
2023-12-01T14:08:49
|
End |
2023-12-01T16:08:58
|
Participant |
Robert Cerny
|
Start |
2023-12-02T05:58:33
|
End |
2023-12-02T06:09:03
|
Participant |
Robert Cerny
|
|
We are sorry
This page cannot be displayed in your browser. Use Firefox, Opera, Safari, or Chrome instead.