Late Static Binding (see Task #3078).

List of methods on which we would like to change to static


I don't think possible to change this method to static: it relies on local variable ($this->table) that can be dynamically changed by forceTable (for instance by Computer_Device).
Update : actually, only few elements use forceTable : Computer_Device and rules children.

For rules children, if we replace by a local getTable method we should not need the forceTable method.

From the Computer_Device, it seems more complicated. But I suggest to implement Computer_DeviceProcessor, Computer_DeviceMemory, etc classes that inherits from Common_Device. Besides that, we will be able to add more specific fields for each junction. Moreover, we should also inherit Common_Device from CommonDBRelation. Thus, we will be able to use its new can* and post_*Item methods.

MoYo : it was the idea. Device management could be completely rewritten and create these classes is the first step.

The patch below (getTable.static.diff) show a possible implementation of such thing. Computer_Device* are not created but can be very small if they inherits from Common_Device.


I think it is possible to change it (cf. task #3811).


CommonDBTM::canCreate(), CommonDBTM::canView(), CommonDBTM::canUpdate() and CommonDBTM::canDelete() can be transform to static. But, some adaptation should be done (see task #3806).

getTable.static.diff Magnifier (5.78 KB) webmyster, 08/06/2012 06:52 PM