getEntitiesFromAttributes() public method

Also accepts all options available to elgg_get_entities(), elgg_get_entities_from_metadata(), and elgg_get_entities_from_relationship().
See also: elgg_get_entities
See also: elgg_get_entities_from_metadata
See also: elgg_get_entities_from_relationship
public getEntitiesFromAttributes ( array $options = [] ) : ElggEntit\ElggEntity[] | mixed
$options array Array in format: attribute_name_value_pairs => ARR ( 'name' => 'name', 'value' => 'value', 'operand' => '=', (optional) 'case_sensitive' => false (optional) ) If multiple values are sent via an array ('value' => array('value1', 'value2') the pair's operand will be forced to "IN". attribute_name_value_pairs_operator => null|STR The operator to use for combining (name = value) OPERATOR (name = value); default is AND
return ElggEntit\ElggEntity[] | mixed If count, int. If not count, array. false on errors.
コード例 #1
0
ファイル: UsersTable.php プロジェクト: elgg/elgg
 /**
  * Get an array of users from an email address
  *
  * @param string $email Email address
  * @return array
  */
 public function getByEmail($email)
 {
     if (!$email) {
         return [];
     }
     $users = $this->entities->getEntitiesFromAttributes(['types' => 'user', 'attribute_name_value_pairs' => ['name' => 'email', 'value' => $email], 'limit' => 1]);
     return $users ?: [];
 }