webCOMAND

Object::get_dimension_with()

Produce the list of values for a WITH clause based on the current object.  More specifically, return an array of dimension field values for this object.  Optionally include the "*" (star wildcard) as the last element in the array, to allow fallback if the return values are not available.

Prototype

array get_dimensions_with(boolean $star = FALSE)

Parameters

  • star - If TRUE, will include "*" as last element in the resulting array, if there are dimensions.  If FALSE (default), no "*" element will be returned.

Return

An array that contains each defined versions of this object for a unique dimension.

Example

// get all contacts in the same dimension as the first found
$repo = \comand::repo();
$contact = $repo->get_first("FROM Contact LIMIT 1");
$dimensions = $contact->get_dimension_with();
$with = implode(',', $dimensions);
$contacts = $repo->get("FROM Contact WITH $with");
foreach($contacts as $contact) {
    echo("OID=" . $contact->OID . ", DOID=" . $contact->DOID . "\n");
}