You are here

public function PartyQuery::propertyCondition in Party 7

Same name and namespace in other branches
  1. 8.2 includes/party.extender.inc \PartyQuery::propertyCondition()

Set a simple property condition on an attached entity.

This doesn't handle more complicated condition sets. If you need that functionality, use PartyQuery::joinAttachedEntity() and set your conditions using the normal SelectQuery methods.

Parameters

$data_set: Either a data set name or a data set array.

$column: A column defined in the hook_schema() of the base table of the entity.

$value: The value to test the field against. In most cases, this is a scalar. For more complex options, it is an array. The meaning of each element in the array is dependent on $operator.

$operator: Possible values:

  • '=', '<>', '>', '>=', '<', '<=', 'STARTS_WITH', 'CONTAINS': These operators expect $value to be a literal of the same type as the column.
  • 'IN', 'NOT IN': These operators expect $value to be an array of literals of the same type as the column.
  • 'BETWEEN': This operator expects $value to be an array of two literals of the same type as the column.

The operator can be omitted, and will default to 'IN' if the value is an array, or to '=' otherwise.

$delta: Optionally specify an attached entity delta you want to query against.

$type string: The type of join. Typically one of INNER, LEFT OUTER and RIGHT OUTER. Defaults to INNER.

Return value

PartyQuery The build PartyQuery.

See also

PartyQuery::joinAttachedEntity().

File

includes/party.extender.inc, line 283
Class to aid querying parties and attached entities.

Class

PartyQuery
Query extender for party attached entities.

Code

public function propertyCondition($data_set, $column, $value, $operator = NULL, $delta = NULL, $type = 'INNER') {

  // Get our entity table alias.
  $entity_alias = $this
    ->joinAttachedEntity($data_set, NULL, $delta, $type);

  // Set our condition.
  $this
    ->condition("{$entity_alias}.{$column}", $value, $operator);
  return $this;
}