Make Parent Model Available
MetaModel items bring a lot of helpful data into the templates. It is especially useful to have full access to associated model instances like
- id
- status -> reference to another model
- id
- name
- firstname
- …
This currently does not work for hierarchical models. The structure then is this:
- id
- pid -> reference to another model
- firstname
- …
It would be helpful if MetaModels could always also query the parent object and return its full data set. Although it is possible to fetch the parent object via the public methods of MetaModels, this is not something one should utilize in a template.
@seaneble it´s possible to you to make a PR?
I have used the public methods quite a lot, but never looked deeper into the core or the DC_General. As project deadline is tomorrow and other projects are waiting, I couldn't promise anything soonish. Let's keep it open and "up for grabs", and I might be able to think of something myself.
As project deadline is tomorrow and other projects are waiting
all of the current "2 1/2 supporter" of MM have this problem... but MM should nonetheless continue to grow...
I have invested about two hours now and tried to understand at which point MetaModels decided to load related data or not. I think I got to that point now, but I have to cease work for now.
One question I would have is whether it is better to
- insert the PID into the collection of "complex attributes"
- or to append it to the arry inside "fetchAdditional Attributes" regardless of that.
Hallo @seaneble hab mir das Ticket mal wieder angesehen und verschiedene Fragen, um das Ziel zu verstehen. Du beschreibst die vorhandenen Daten eines per Relation angebundenen Models - das hat mit "Parent" ber nichts zu tun.
In einem hierarchischem Model gibt es natürlich den Weg "nach oben" und "nach unten" - das kann man mit einem "Tree walker" aufdröseln. Da wäre die Frage, was man da liefern soll? Jemand möchte den Parent oder alle Parents - jemand anderes die Childs usw. - den gesamten Baum bei jedem Item mitzugeben wäre sicher zu viel.
Da müsste man eine Lösung für den konkreten usecase finden und ggf. einen "Tree walker" als "Helper" zur Verfügung stellen.