LampCMS development and php tips

Announcements and articles about this site development and stuff like that

Idea for resource object
Sun Nov 22 2009
A resource object (just a general object, usually represents an item from RESOURCE table)
should be of type clsArrayDefaults
and most importantly have a method saveResource()
which will record all the data into Table (usually RESOURCE) and if it has the value of id, then it will update the record, otherwise it will insert new record.

This last logic can be  acheived also in the mysql query ON DUPLICATE KEY UPDATE, but it's probably going to require a logner and messier query.

This object will have the $this->hdlDb which is will get via clsDb::getInstance()
it will also have method getComments() to get all comments for this resource.

commens may be represented by a special array or object which must be serializable and should be obtained via the clsCache object

This type of object can also be used for a forum message or a mailing list message for example.
The message object may be populated via the clsElistParser and then calls the saveMessage() which will do all the necessary things to insert data into various tables. It should probably even have a special object just for saving message data just because the data of one message is usually saved in several tables like HEADERS in one table, BODY in another, also THREAD is updated, etc.

For a forum module this should definetely be used.

Also should be used for image and video objects.