It is a static object
- Does not have superclass
- Does not have subclasses
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.
3.4. Methods:public void static addMessages($messages)
This method adds some new messages to the basic array of DomCore messages.
public void static setMessagesFile($file)
- $messages: Array of messages, the index is the ID of the message and the value the message itself.
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.
public string static getMessage($id)
- $file: Path string to the XML language of messages translation.
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.