public static function load_match($r, $load_attrs = true) { $where = " WHERE 1 "; $args = array(); foreach ($r as $k => $v) { $where .= " AND {$k}=?"; $args[] = $v; } $relations = self::load_many_from_query("EntityRelation", "SELECT * FROM {entityrelations} {$where}", $args); if ($load_attrs) { // get attributes foreach ($relations as $relation) { $relation->attributes = EntityRelation::load_attributes($relation->id); } } return $relations; }