Locker\Repository\Statement\EloquentIndexer::matchAgent PHP Method

matchAgent() private method

Constructs a builder using the given agent and options.
private matchAgent ( stdClass $agent, Jenssegers\Mongodb\Eloquent\Builder $builder, IndexOptions $opts ) : Jenssegers\Mongodb\Eloquent\Builder
$agent stdClass Agent to be matched.
$builder Jenssegers\Mongodb\Eloquent\Builder
$opts IndexOptions Index options.
return Jenssegers\Mongodb\Eloquent\Builder
    private function matchAgent(\stdClass $agent, Builder $builder, IndexOptions $opts)
    {
        $id_key = Helpers::getAgentIdentifier($agent);
        if ($id_key === 'account') {
            $builder = $this->matchAgentProp('account.homePage', $agent->account->homePage, $builder, $opts);
            $builder = $this->matchAgentProp('account.name', $agent->account->name, $builder, $opts);
        } else {
            $builder = $this->matchAgentProp($id_key, $agent->{$id_key}, $builder, $opts);
        }
        return $builder;
    }