webCOMAND

Content::approve()

Update the objects various versions as follows:

  • Save a historic version of the previous approved version if required by the configured version control policy.
  • Save the object and its embedded objects to the repository as the approved version of the object.  Any fields locked by other users will not be updated.
  • Eliminate any previously saved drafts.
  • Update the working copy and unlock any fields previously locked by the current API user.

Prototype

boolean approve(array $options = [])

Parameters

  • options - Optional associate array of key/value pairs available to define options that influence how an object is saved to the repository.  The following options are recognized by the base COMAND Object.
    • CreateNonexistentReferences - TRUE = If a referenced object does not exist in the repository, the object and reference will be added to the repository. FALSE (default) = If a referenced object does not exist in the repository, neither the object no the reference will be added to the repository.
    • Fields - Array of dot-notation fields to update.  No other fields will be saved, which makes it possible to only save some modified/locked field values, while leaving others unchanged.
    • SaveReferencedObjects - TRUE = Save referenced objects if they have been changed. FALSE (default) = Do not save referenced objects if they have been changed. CreateNonexistentReferences will override this option to save objects that do not already exist, even if this option is FALSE.
    • SkipValidation - TRUE = Do not perform validations. FALSE (default) = Perform validations.
    • ThrowExceptions - TRUE = Allow an exception to be thrown on certain errors.  FALSE (default) = Log an error to the repository event log instead of throwing exceptions.
    • VersionNotes - A plain-text string that contains a version note to associate with this version.  Version notes appear in the Versions Sidebar.

Return

TRUE if the object was approved to the repository.  Otherwise, FALSE.

Example

$repo = \comand::repo();
$pub_proc = $repo->new_object('PublicationProcedure');
$pub_proc->Filename = 'index.html';
$pub_proc->approve(['CreateNonexistentReferences'=>TRUE]);