Combining fields defines a way to uniquely identify an object.
Useful for finding if a dataobject with given field values exists.
Protects against SQL injection, and searching on unauthroised fields.
Ignores fields that don't exist on the object.
Adds IS NULL, or = 0 for values that are not passed.
Similar to SearchContext
Conjunctive query
Example input:
$data = array(
'FieldName' => 'data'
'AnotherField' => 32,
'NotIncludedField' => 'blah'
);
$required = array(
'FieldName',
'AnotherField',
'ARequiredField'
);
Example output:
"FieldName" = 'data' AND "AnotherField" = 32 AND "ARequiredField" IS NULL