orionjs / orioncms

[Old] Orion is an open source framework built on Meteor that makes complex as well as simple apps possible with minimal effort.
http://orionjs.org
MIT License
715 stars 129 forks source link

Question : Creating a getter on the Orion Collection #333

Closed rwatts3 closed 9 years ago

rwatts3 commented 9 years ago

Hi Nicolas,

I am trying to create a getImages helper similar to how you have a getCreator helper for one of my schemas.

I have declared an Assets schema where I will be reusing and sharing assets accross multiple other schemas and I'm curious if I must declare a publish composite for this in order to properly get the data of the image based on a relationship attribute.

Essentially here is the workflow.

Assets Collection & Schema Products Collection & Schema

Products Schema contains a relationship where multiple images can be assigned from the Assets Collection.

When I render the Product Detail. I want to be able to grab the product image (which is a relationship attribute) from the Assets Collection.

nicolaslopezj commented 9 years ago

Yes, you must use publish composite in this case. You can also use dburles:collection-helpers to create the getter.