====== VTEntityData Objects ====== The VTEntityData object provides access to an entity object (a record in the application). It implements (among others) the following methods ===== getModuleName ===== Returns the module name of the entity. ===== getId ===== Returns id of the entity, this will return null if the id has not been saved yet. ===== getData ===== Returns the fields of the entity as an array where the field name is the key and the field's value is the value. ===== isNew ===== Returns true if new record is being created, false otherwise. Example: Event handlers add/update distinction class MyModuleEventHandler extends VTEventHandler { function handleEvent($eventName, $data) { if ($data->isNew()) { // Creation of new record } else { // Editing existing record } } } ===== Modifying the fields of the entity object ===== In certain events, for example, 'vtiger.entity.beforesave.modifiable' it is possible to modify the entity, so that it gets saved. e.g, for an VTEntityData object called //$data// you can change the field //simple_field// to the value 'value' using the following code. $data->set('simple_field', 'value'); Now the entity will get saved with simple_field saved as 'value'.