preventing exceptions in rendering a timeline element
Closed this issue · 3 comments
Hi, I have a complex range of timeline elements with different data structures so its possible that sooner or later something breaks and I get an exception that blows up the entire timeline if it gets raised within the tig call 'timeline_render'.
What would be the best way to achieve the following behaviour from timeline render (de facto its a try and catch):
- if the rendering of one element fails just ignore this element and go on to render the remaining timeline elements.
Thanks so much for any help
sergio
Hi,
timeline_render
behavior is simple. You have documentation here
- First of ALL, it search for a verb twig file. Fallback is here
Your verb file looks like to something like that:
{{ timeline_component_render(timeline,'subject') }} eat with {{ timeline_component_render(timeline,'directComplement') }}
Here, you see the usage of timeline_component_render
. By default, it call the __toString
method of object or use string.
You are able to uses components to customize the render of yours object/verbs.
Where would you have an exception ?
If it's on the verb file, you should use twig asserters because timeline bundle cannot do anything.
{% if action.hasComponent('directComplement') %}
.........
{% endif %}
If it's because integrity of complements is not sure, you should look at DataHydrator filter and its option to remove unloaded components
I hope i answered to your questions.
Thank you for your reply.
Yes its related to the integrity of components. Will look at the dataHydrator filter. Thanks for pointing me to the solution :) 👍
You're welcome.