stephpy/timeline-bundle

Rendering Complement (Direct/Indirect) Objects

Closed this issue · 4 comments

Hi there,

I am storing the following activity:

User Object (subject) -> announced-> Announcement Object (directComplement)

My render twig (announced.html.twig) is as follows:

{{ timeline_component_render(timeline,'subject') }} announced {{ timeline_component_render(timeline,'directComplement') }}

which outputs Paul Pounder announced

Now if I change it to store the following:

User Object (subject) -> announced-> User Object (directComplement)

I can output the User Object (toString) method so that it displays Paul Pounder announced paulpounder
This works because I'm using the same component that is created in the findOrCreateComponent() method when setting up the timeline.

I have a toString() method in my Announcement Entity, but it doesn't recognise it.
It is recognising the entity ok, as I can run

{% block _acme_demobundle_entity_announcement_default_component %}
Test {{ value }}
{% endblock _acme_demobundle_entity_announcement_default_component %}

Where it outputs Test only. User object works ok, I just can't work out why I can't output any other Object/Entity when stored as a complement? I get nothing when I display {{ value }} in my components.html.twig file (above).

I've checked the DB tables and everything is storing the same between User and Announcement Direct Complements.

I've checked everything and it seems the component->getData() isn't pulling any data for the Announcement entity (or any other entity stored in the directComplement etc). This only runs and is set with the findOrCreateComponent method using resolveModelandIdentifier().

So what I'm basically asking is, how do I render an object when stored as a complement? Baffled again :-)

Would appreciate any help.
Kind regards,
Paul Pounder

Sorted, Added Filters

:)

Thanks @npotier :)