The WebAbility® Network Developers - Documentation
WebAbility Site
\core\WAClass reference

I. WAClass Structure:

- namespace:

- Direct superclass:

- Direct known subclasses:

- Implements:

II. Description:

This is the class to create a unified application serializable object with specific properties.
The class has nothing more than WAObject except it should be serializable.

The class comes with 2 new methods, serial() and unserial() that must be overloaded by the extended class.
This is because only the extended class knows how to serialize its attributes and how, and not all the attributes should always be serialized (for example by an automatic process), like a password, file stream or a database link for example.
serial(&$data) is called with an array as referenced parameter you just need to fill.
unserial($data) is called with the same array you just need to assign back to your own attributes.

The unserialization process calls the __construct() method of the WAObject and WADebug so it can be adjusted for DEBUG core if needed.

You may also replace directly the serialize() and unserialize() methods that comes with the Serializable interfase.
In this case, copy-paste the WAClass code and modify at your will. Do not forget to call the parent::__contruct() into the unserialize() method.

If you do not overload the serial() and unserial() methods, an error will be thrown during serializing/unserialize the instance.

We highly recommend to extend your classes directly or indirectly from WAClass only if you plan to serialize/unserialize them.

Note the WADebug attributes are not serialized by default by the serialize method.

III. Reference:

3.1. Contructor:

Creates the instance. It will call the constructor of WAObject.

3.2. Constants:

There are no constants into this class.

3.3. Attributes:

There are no attributes into this class.

3.4. Methods:

protected void serial(&$data)
You may overload this method to assign your own data (class attributes and others at will) to the serialization process.
  • &$data: array, all the variables to serialize. It is empty when it is called by WAClass method.

protected void unserial($data)
You may overload this method to assign back your own data to your instance during the unserialization process.
  • $data: array, all the variables ready to reassign to your instance. This must be the same array as created in serial() method.