When creating templates for document output, I would like to access the fields of ObjectBricks or many2many relations. With the relations, I can only access the path of the relation via Twig, but not the content of the object. With ObjectBricks I can't get any further via Twig. I understood that all objects that are addressed in a class are loaded. Or do I have to create extra snippets or views for each object, which are then included in the template? This then again in PHP and not in Twig?
Example : a product has a m2m relation to a class "Material" , which contains the field "Description".
{% set matdate = product.Material %}
{% if matdate %}
{% for element in matdat %}
{{ element }}
so far it works, but
{% if(item) %}
{% for dat in element %}
{{dat}}
{% endfor %}
{% endif %}
When I then address the array, I get no content and no error.
Unfortunately, the descriptions from the Pimcore documentation don't help me with the ObjectBricks either. I can't figure out how to query them.
Maybe it's just a problem of understanding that is clear to everyone, but I can't find an answer.
Here is the dump:
Pimcore\Model\DataObject\Data\ElementMetadata {#4103 ▼
#elementType: "object"
#elementId: "88"
#fieldname: "Material"
#columns: array:1 [▶]
#data: []
#dao: Pimcore\Model\DataObject\Data\ElementMetadata\Dao {#4078 ▶}
#_owner: Pimcore\Model\DataObject\Implantat {#4079 ▶}
#_fieldname: "Material"
#_language: null
elementType: "object"
elementId: "88"
fieldname: "Material"
columns: array:1 [▶]
data: []
_owner: Pimcore\Model\DataObject\Implantat {#4079 ▶}
_fieldname: "Material"
_language: null