Using the CMS_ObjectRelationship table

Christian Nickel asked on November 12, 2014 16:54


I was hoping someone could help me understand the use of the CMS_ObjectRelationship table. I was wondering if this was strictly for Module classes or if I could re-use this table to relate rows in Custom Tables?

A site I'm working on will have quite a few many-to-many relationships between rows custom tables and I'd like to use a single table for these relationships similar to how the CMS_Relationship table is used to store Related Documents.

I can see that this table would work for my purposes, though I don't know if it will support staging/synchronization as it isn't mentioned in the documentation.

On the same topic, the CMS_RelationshipName table has a field for RelationshipAllowedObjects, and it shows ;##DOCUMENTS##; or ;##OBJECTS##; depending on the object relationship type chosen. Besides specifying the type (Documents/Objects), can this field be used to store the actual types that can use a specific relationship? For instance can I add a new row with values in RelationshipAllowedObjects that specify which document types can use that relationship?

Sorry for all the questions, but I'm trying to reuse existing functionality even if there isn't documentation for it.

Thanks ahead of time for your answers!


Correct Answer

Christian Nickel answered on November 18, 2014 17:49

I set my question to Kentico support and received the following answer:

Hi Christian,

Thank you for your message.

I have checked with our development team and they recommend not using the object relationship. It was added to Kentico as a draft of basic functionality but in the end did not turn out to be as useful, and never finished. So for example it will not stage. It is currently scheduled for removal in one of the future major Kentico versions. Using custom table to store your relationships is the best way how to implement your functionality.

Please let me know if there's anything else I can do for you.

Best regards,

Josef Dvorak E-Commerce Senior Support Specialist

0 votesVote for this answer Unmark Correct answer

Recent Answers

Virgil Carroll answered on November 12, 2014 21:08

Where I do not know exactly how supported your idea would be, Martin Hejtmanek, From Kentico just gave a talk yesterday on the extensibility of module customization. I would say this would be a great question to send to Kentico Support as they could direct you in the way of what is possible on that side and what could cause future support issues.

I also am a firm believer in trying to leverage what is there, even if you are using it for another purpose.

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on November 13, 2014 05:03

If you have these kinds of relationships, you might rethink using Custom Tables. Why not create your own custom module with classes in them and use a binding object to bind the newly created classes together. All of this can be done with out of the box functionality in v8.x.

A few benefits to this approach are: * you can create the whole admin interface using page templates and webparts * you get strongly typed references to all your objects * you have to write very little or no code * you can display the data on the live site with little effort

0 votesVote for this answer Mark as a Correct answer

Christian Nickel answered on November 13, 2014 15:56

@Virgil Carroll, I've just submitted a question to support to see what they recommend. Thanks for the insightful response.

@Brenden Kehren, While this sort of situation can easily be completed with a Custom Table or with using binding objects in a Custom Module and I'm very familiar with both. But the process to create a custom module takes quite a bit longer than I would like and for our purposes, custom modules are not supported by staging (not sure if their data is or not), and the process to create an admin interface inside Kentico on a Web Application for custom modules is quite sluggish. We've instead decided to create an AngularJS application using Kentico's REST API, which means there is no need to build the app every time we make a code change. On top of that, we like writing code! But we also want to make sure that we re-use components that are available, and if use of this table for custom development is not supported (especially through the REST API) then we will not use it.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.