webCOMAND

repo::with()

Set a default WITH clause that will be applied to all repository queries and object retrievals, to instate a preference for certain dimensions.

Prototype

string with(string $with = NULL)

Parameters

  • with - cQL WITH clause (the part that comes after the WITH keyword).  If no with is specified, the current "repository with" will be returned without making a change.  Set to '*' or FALSE to "unset" the current "repository with".

Return

The current "repository with".  If the repository does not have dimensions enabled, NULL is returned.  If the repository does have dimensions enabled, but no "repository with" has been set, then FALSE is returned.

Example

// instate a preference for English content with fallback to
// French and then the object's default language
$old_with = $repo->with("EN, FR, *");
$contacts = $repo->get("SELECT * FROM Contact WHERE Name='John'");
foreach( $contacts as $contact ) {
	echo( $contact->Name . " - " . $contact->Phone . "\n" );
}