I have a list of VisualForce components called VFComponent, a list of attributes name VFAttributes and a junction object VFComponentToAttribute that links them in a many to many relationship.
I am trying to get a list of components, in the form of:
List<VFComponent__c> VList = [Query here FROM VFComponentToAttribute];
For the query I have tried getting Id, VFComponent__r.Id, VFComponent all to no avail. Everything I try seems to give me a type error.
Could someone be kind enough to explain how I could get a list,populated with child objects from the junction object in this way.
To clarify I am trying to pass a list of objects to some other code, but in general I would like to better understand what Salesforce actually stores in the junction object, I thought is was something like a key, but if I query the Id and try to use that I get type mismatches as well:
List<Id> idList = [Select childobject__r.id From JuncitonObject];
That gives me also gives an error as if the query result were objects and not IDs, which I suppose they are?
In short I am confused.
VFComponentToAttribute
isn't the Parent. Instead, it's really a child of both the other 2 objects. It has a look-up to each of the parents. When you run a query, you're essentially searching for the intersection of those lookup records when you queryVFComponentToAttribute
. All that object really contains is links to the other objects.