When building a query, the following operators are available:
| Function | Description |
|---|---|
| eq | Equal to (==) |
| ge | Greater than or equal to (>=) |
| gt | Greater than (>) |
| le | Less than or equal to (<=) |
| lk | Like |
| lo | Logical operator (AND, OR, (, )) |
| lt | Less than (<) |
| ne | Not equal to (!=) |
| nl | Not Like |
| rf | Reference |
<?php
$credentials = new Credentials('mysql_username',
'mysql_password');
$workspace = 'pcr';
$session = Repository::login($credentials, $workspace);
$qb = new QueryBuilder();
//gets all nodes under the pcr:root/users node
//with a property "lastName" and a value starting with "W"
$qb->lk('pcr:path', 'pcr:root/users/*');
$qb->lo('AND');
$qb->lk('lastName', 'W*');
$query = $session->getWorkspace()->getQuerymanager()->createQuery(
$qb->getStatement()
);
$qr = $query->execute();
$ni = $qr->getNodes();
if ($ni->hasNext()) {
while ($ni->hasNext()) {
$temp = $ni->nextNode();
echo $temp->getPath() . '<br />';
}
} else {
echo 'no users found';
}
?>