webCOMAND

cObject::reload_data()

Update the PHP object in memory with the field values in the repository.  It will update the PHP object with any changes that may have occurred to the object in the repository since it was last loaded.  By default, any field values that have been modified in the PHP object since it was initially loaded will not be updated.  If the optional parameter is TRUE, it will also revert any changes made to the PHP object in memory to the values in the repository.  PHP objects do not automatically update as changes are made in the repository.

Prototype

void reload_data(boolean $overwrite_modified = FALSE)

Parameters

  • overwrite_modified - If TRUE, fields modified since the object was first loaded will be updated to the value in the repository.  Otherwise, modified values will remain, even if different than what is in the repository.

Return

Nothing is returned.

Example

$repo = \comand::repo();
$contact = $repo->get_first('FROM Contact LIMIT 1');
$contact->FirstName = 'Jim';

sleep(60);

// reload field values that may have changed in the repository
// if FirstName has changed in the repository, it will not be
// reloaded because it was modified above.
$contact->reload_data();