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

I. Structure:


- namespace:
\core\

It is a static object
- Does not have superclass
- Does not have subclasses

II. Description:


This is a static class that contains the basic messages in any needed language for static object error messages.

The class is absolutly not made to manage big language tables at application level scale but rather used for very basic static error that could happen in static objects during the loading of the main application core.

The WAMessage object already contains the DomCore basic errors and can be added with more basic errors of your own classes.
The default messages are in english into the \core\WAMessage itself.

Those messages can be translated into the object (not recommended or you will loose your translation in case of upgrading).
Those messages can be linked to a translated file that will be loaded only if required, in case of error. This is the recommended method to apply your own language.

The translated file is an XML that will be parsed and compiled with \core\WALanguage.

The default messages already created into the class are the following:

WAMessage.notfound = 'Error: The message was not found for the ID: '
WAObject.badget = 'Error: the attribute to read does not exist: '
WAObject.badset = 'Error: the attribute to write does not exist: '
WAObject.badcall = 'Error: the called method does not exist: '
WAClass.serial = 'Error: you must declare your own serial() method'
WAClass.unserial = 'Error: you must declare your own unserial() method'
WAFile.mkdirproblem = 'Error: the directory could not be created: '
WAFile.unknownfile = 'Error: the file is not recognized: '
WAFile.baddir = 'Error: the path to delete recursively is not compliant to be deleted: '
WASHM.nosharedmemory = 'Error: There is no available shared memory.'
WASHM.noattach = 'Error: We could not attach to our shared memory.'
FileSource.file eerror = 'Error: The file could not be opened for writing: '
Singleton.noclone = 'Error: the singleton already exists and cannot be cloned: '
Multiton.noclone = 'Error: the multiton already exists and cannot be cloned: '

You must consider them into the language file you may create.


III. Reference:


3.1. Contructor:

none

3.2. Constants:

none

3.3. Attributes:

none

3.4. Methods:


public void static addMessages($messages)
This method adds some new messages to the basic array of DomCore messages.
  • $messages: Array of messages, the index is the ID of the message and the value the message itself.

public void static setMessagesFile($file)
This method will link a messages file to the object.
The messages file is an XML file described into the WALanguage object.
The messages file should have all the entries built into WAMessage and the ones you can add with the addMessages method.
  • $file: Path string to the XML language of messages translation.

public string static getMessage($id)
This method returns the messages of the corresponding $id. If there is a linked file and the file is not loaded yet, it will be loaded before returning the message.
  • $id: string, the ID of the desired message.