<?php

namespace Lc\SovBundle\Repository\User;

use Knp\Component\Pager\PaginatorInterface;
use Lc\SovBundle\Repository\AbstractRepositoryQuery;

class GroupUserRepositoryQuery extends AbstractRepositoryQuery implements GroupUserRepositoryQueryInterface
{
    public function __construct(GroupUserRepository $repository, PaginatorInterface $paginator)
    {
        parent::__construct($repository, 'groupUser', $paginator);
    }

    protected $isJoinUsers = false;

    public function joinUsers(): self
    {
        if (!$this->isJoinUsers) {
            $this->isJoinUsers = true;
            return $this
                    ->leftJoin('.users', 'users');
        }
        return $this;
    }
}
