- ⌂ Content
- Methods
Content Model
- Class Name: Content
- Namespace: io_comand_repo\models
- Extends: cObject
- Implements: nothing
Content extends cObject, adding version control, collaboration and dimension features.
Properties
Content does not add any properties to Object.
Version Control
Version control features are primarily accessed through the following methods:
- approve() - create or update the approved version of the object, removing any/all draft versions and keeping a historic version of the previously approved version when applicable.
- save() - save a new draft version of the object
- store() - save/update the working copy of the object
- revert() - remove the working copy of this object and release any locked fields, effectively restoring the "working copy" to the latest saved/approved version (or removing the object if no saved/approve version exists yet).
Collaboration
Collaboration features are primarily accessed through the following methods:
- lock_fields()
- unlock_fields()
- has_field_lock()
- is_field_locked()
Dimensions
Dimensions, if enabled, make it possible to store multiple content variations. For example, a Language dimension makes it possible to translate the same content into multiple languages. Multiple dimensions can be combined for even more variations.
Queries can specify which variations to prefer with a series of fall backs to match on the best variation available. For example, US English might be the preferred language, but if that is not available, fall back to UK English, French and then the content default.
Example
// utilize version control methods to save and manipulate
// various versions of an object
$contact = $repo->new_object('Contact');
$contact->FirstName = 'John';
$contact->store(); // update the working copy
$contact->LastName = 'Smith';
$contact->save(); // create a new draft
$contact->LastName = 'Doe';
$contact->approve(); // create approved version
$contact->FirstName = 'Jane';
$contact->store(); // update the working copy
$contact->revert(); // restore working copy to "John Doe"
// TODO: Utilize collaboration methods to lock and update
// what other users can do and see in webCOMAND.
// TODO: Utilize dimension methods to manage variants