Forums / Developer / Building Class Hierarchies

Building Class Hierarchies

Author Message

Tristan Koen

Thursday 12 June 2003 6:50:04 am

Hi All,

Is it possible to build class hierarchies in ezPublish? If I create two classes, A and B, I want to build them so that instances of B can only have an instance of A as a parent. Very much like a foreign key relationship in an RDBMS.
I could simulate this behaviour using related objects, but I cannot enforce the relationship which doesn't help.

Bruce Morrison

Thursday 12 June 2003 4:28:46 pm

You can do this using permissions. Configure the system so that you can only create a class B for parents of class A.

Class A acts like a "folder" having child content of class B.

Cheers
Bruce
designIT

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

Tristan Koen

Friday 13 June 2003 1:22:55 am

Hi Bruce.

Thanks for the answer, but you have really confused me. Where you say "Class A acts like a "folder" having child content of class B", that is exactly what I want, but I don't understand your reasoning.

My understanding is as follows:
1. Create class A and class B. Class B will have a "related object" attribute that will be used to make the link to A.
2. In the admin interface, create a new role called ABhierarchy for arguments' sake.
3. The role would make the following restriction:
- Module: content (you can't do all of them which makes me wonder why there is an 'All' option in the first place).
- Function: create
- Class: B
- Section: Any
- Parent Class: A
4. Apply this role to all of your users?

The problem with this approach is that the restriction is placed on the user, not on the data itself. I realise that the two are somewhat equivalent from a practical point of view, but it is possible that a mis-configured user could make a big mess. If you mean something else, please explain. I am getting horribly stuck here.

I would also like to have a data structure where an arbitrary number of objects of Class B can be created as children of object A.

Thanks

Tristan