Forums / Suggestions / Class extensions

Class extensions

Author Message

Sao Tavi

Wednesday 23 March 2011 5:30:51 pm

This is something that I came across and it could be pretty useful. The implementation would not be tricky, but the results should be pretty rewarding in putting the URLs in order.

So, my proposal is class extensions. That is the possibility to create extensions for specific classes.

For example, let's consider we want to create with eZ Publish a wiki. Each wiki page (class 'wiki_page') should have a discussion forum (module forum extends class wiki_page). We would like to access this forum by the URL modern-engine/wiki/my-topic/discussion and not with discussion/topic_id or modern-engine/wiki/my-topic/(discussion) (I don't actually know if the last one is correct, I am still learning eZ Publish).

The second example: we have a class user that will contain user data. The URL to access elements of this class would be users/{username}. I would like to extend this class with module (let's say we have a gaming website) high-scores, so everyone can see the user's high-scores. Or, let's say we access the list with his forum activity, article written, rated articles, a photo album and so on. Yes, I agree, using the user's id we can still do that, but that is like programming with arrays and using the keys to identify the correlated data instead of using objects.