webCOMAND

cObject::approve()

Save the object and its embedded objects to the repository as the approved version of the object.  See

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.
    • OverrideProtected - Will allow protected Content Types (Protect checked within the Content Type) to be updated, but only if the repo user is a System Admin and the Content Type Protect field is currently FALSE.
    • 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.
    • VersionNotes - A plain-text version note to associate with this version.  Version notes appear in the Versions Sidebar.

Return

TRUE if the object was approved and committed 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]);