How can I find users by field value? I have a field in my users of type user. This field holds a user's employer (another user).

How can I get a collection of all the employees in a plugin?

I tried craft()-&gt;users-&gt;relatedTo($currentUser); (where $currentUser is the employer) as that's pretty much how I'd do it in a template, but of course relatedTo isn't part of the usersService.

So how can I do this without just getting every user, checking their employer field and filtering out the matches?
ElementCriteriaModel supports 'users' as well as 'entries'.

$criteria = craft()-&gt;elements-&gt;getCriteria(ElementType::User);
$criteria-&gt;relatedTo = array(
    'targetElement' =&gt; $currentUser,
    'field'         =&gt; $employer
);
$employees = craft()-&gt;elements-&gt;findElements($criteria);