Kevin
Well-known member
OK, please bear with me on this one as I explain what I'm trying to do...
This is a follow-up to my earlier question where I have a new side table that contains a list of attachment_id values. The table is one-to-one relationship between it and the attachment table using attachment_id as the foreign key relationship. I have an entity definition for the new side table with a relation to XF:Attachment and that relation has a 'with' for the associated Data. In the add-on I'm working on it has corresponding finder & repository classes.
That stuff is all working beautifully and I get my list of rows from my side table with the associated attachments in the relations collection. With what I have in place so far I can display the attachments on in my output page and can work with them as expected.
But... besides the attachment info I'd like to get the content info that the attachment is associated with. If it is a 'post' attachment content_type then I'd like to be able to get the post entity info and it's associated relations so I can grab the thread title, user name, and so on.
I know from my earlier question (by digging into the demo portal code) that if I had collection of, for example, thread entities then I can grab the first post of the thread and use addAttachmentsToContent to retrieve the attachments associated to the post. What I haven't been able to find is if there is any type of function to go the other way around, to retrieve the Content based on the Attachment.
Any suggestions?
This is a follow-up to my earlier question where I have a new side table that contains a list of attachment_id values. The table is one-to-one relationship between it and the attachment table using attachment_id as the foreign key relationship. I have an entity definition for the new side table with a relation to XF:Attachment and that relation has a 'with' for the associated Data. In the add-on I'm working on it has corresponding finder & repository classes.
That stuff is all working beautifully and I get my list of rows from my side table with the associated attachments in the relations collection. With what I have in place so far I can display the attachments on in my output page and can work with them as expected.
But... besides the attachment info I'd like to get the content info that the attachment is associated with. If it is a 'post' attachment content_type then I'd like to be able to get the post entity info and it's associated relations so I can grab the thread title, user name, and so on.
I know from my earlier question (by digging into the demo portal code) that if I had collection of, for example, thread entities then I can grab the first post of the thread and use addAttachmentsToContent to retrieve the attachments associated to the post. What I haven't been able to find is if there is any type of function to go the other way around, to retrieve the Content based on the Attachment.
Any suggestions?