src/Sulu/Bundle/SecurityBundle/Entity/UserRepository.php
public function findUserBySystem($system)
    {
        $queryBuilder = $this->createQueryBuilder('user')
            ->select('user', 'contact')
            ->leftJoin('user.userRoles', 'userRoles')
            ->leftJoin('user.contact', 'contact')
            ->leftJoin('userRoles.role', 'role')
            ->where('role.system = :system');

        $query = $queryBuilder->getQuery();
        $query->setParameter('system', $system);

        return $query->getResult();
    }
public function findUserBySystem($system)
    {
        $queryBuilder = $this->createQueryBuilder('user')
            ->select('user', 'contact')
            ->leftJoin('user.userRoles', 'userRoles')
            ->leftJoin('user.contact', 'contact')
            ->leftJoin('userRoles.role', 'role')
            ->where('role.system = :system');

        $query = $queryBuilder->getQuery();
        $query->setParameter('system', $system);

        return $query->getResult();
    }
public function findUserBySystem ( $ system ) { $ queryBuilder = $ this -> createQueryBuilder ( 'user' ) -> select ( 'user' , 'contact' ) -> leftJoin ( 'user.userRoles' , 'userRoles' ) -> leftJoin ( 'user.contact' , 'contact' ) -> leftJoin ( 'userRoles.role' , 'role' ) -> where ( 'role.system = :system' ) ; $ query = $ queryBuilder -> getQuery ( ) ; $ query -> setParameter ( 'system' , $ system ) ; return $ query -> getResult ( ) ; }
Returns all users with the given system including their contacts.

@param string $system

@return User[]
Returns all users with the given system including their contacts .