User Login    
 + Register
  • Main navigation
Vote for XOOPS!!!!
Login
Username:

Password:


Lost Password?

Register now!
Documentation
Who's Online
83 user(s) are online (4 user(s) are browsing XoopsWiki)

Members: 2
Guests: 81

burfodus, ponsy, more...
[Main Page]

Dev:XoopsObjectAndHandler

From XOOPS Project

Main Page | Recent changes | Edit this page | Page history | Switch to MediaWiki mode

Printable version | Disclaimers | Privacy policy
Category: Development

Xoops has two abstract classes to aid in the class development XoopsObject and XoopsObjectHandler

The idea behind them is that a class can extend XoopsObject to describe an object, whereas extending XoopsObjectHandler will give more like an interface for handling the objects, i.e. get, insert, delete and create objects. E.g. for a ThisObject class, you can make a ThisObjectHandler to get, insert, delete and create ThisObject objects.

The advantages of extending these two classes are for XoopsObject:

   Automatic access (inheritance) to methods, easing the assignment/retrieval of variables
   Automatic access to methods for cleaning/sanitizing variables

and for XoopsObjectHandler:

   A place to put all those functions working with more than one object (e.g. a "getAllObjects()" function)
   These functions will become easier to track down in the file system (since they are connected to a class, it is just a matter of finding the class and not going through the function files in the module/core/PHP native in search for it.

An additional idea is that the XoopsObjectHandler-extending class should be a Data Access Object, i.e. the class, which handles database calls - and leaving the XoopsObject-extending class to have object-describing methods, such as methods which handle and manipulate variables, calling methods on the handler for retrieving, updating and inserting data in the database.

NOTE: A change in the class factory method is expected in Xoops 2.2, so the advice from the core devs is that you should not go to a great length to change existing modules to follow this architecture - however, I hope that this guide makes it easier to understand the core classes, which use this architecture.


Back to Main Page

Retrieved from "http://www.xoops.org/modules/mediawiki/index.php/Dev:XoopsObjectAndHandler"

This page has been accessed 358 times. This page was last modified 17:22, 15 December 2007. Content is available under XOOPS Project.


Local Support Sites
Powered by
XOOPS Code hosted on SourceForge

Powered by PHP



Powered by MySQL

Powered by Smarty

OSI certified

All content on this site is subject to the Creative Commons License
Developers for Hire