Projection queries on Container Id

Topics: Core
Oct 19, 2012 at 8:54 PM

I came upon a use case where I wanted to use a projection to switch between showing content from multiple different blogs on our site by filtering on the blog posts' blog id.There are alternative ways to accomplish what I want, but I discovered something in the process.

The BlogPostPart uses the CommonPart's Container property. Unless I'm missing something, the CommonPartRecord.Container property is not represented anywhere by default in projections. The default binder provider looks like it only describes non-reference types, so it isn't possible to filter anything by its container unless you implement a binder provider specifically to do that (or perhaps for all ContentItem reference properties, exposing them as {PropertyName}Id).

I think that querying on ContentItem reference properties should be provided in core. Is this unrealistic? I could see this going into 1.7.

Oct 19, 2012 at 8:56 PM

If there isn't a bug tracking this, please open one.

Oct 20, 2012 at 9:48 PM

By pure chance my Helpful Libraries module happens to have a filter provider for that in its Contents Libraries feature (see the docs, look for "ContainedByFilter Projector filter").

Oct 31, 2012 at 9:57 PM
bertrandleroy wrote:

If there isn't a bug tracking this, please open one.

Like CPyle I wondered about this also and opened a ticket ( but Sebastien closed it. I have not had the time yet to try his recommendation of creating a custom filter, but I might try Piedone's module for myself.