As far as a dmBridge module is concerned, there are two types of models: those
that are native to dmBridge and those that are not. dmBridge-native models include
DMComment, etc., all of which inherit from
DMModel. Non-native models could be any other class,
including ones that the module defines itself.
You should avoid subclassing dmBridge models to add new functionality. Doing so introduces unpredictable divergences in the class hierarchy which, with multiple interdependent modules active simultaneously, is likely to cause serious problems.
Using a custom model is simple: write it, save it to your module folder, and use it. Using a dmBridge model is similarly easy. However, there are instances where your module will need to add new functionality to existing dmBridge model classes, so that a dmBridge module will respond to its own methods, plus custom methods you've defined. The recommended method of achieving this is as follows:
Define your own model class that consists of only the functionality (i.e. methods) you would like to add to a given dmBridge model class.
Given an instance of your model class,
$mymodel; and a
dmBridge model instance,
$dmmodel; associate your custom
instance with the dmBridge instance by calling
Now, with the
$dmmodel instance having been "associated" with
your own custom instance, it will respond to all of the methods that
$mymodel would, using built-in PHP "magic."
Try to give your custom model methods distinctive names, otherwise they could clash with those from other modules.