eZ\Bundle\EzPublishCoreBundle\Features\Context\UserContext::checkUserExistenceByEmail PHP Метод

checkUserExistenceByEmail() публичный Метод

Checks if the User with email $email exists.
public checkUserExistenceByEmail ( string $email, string $parentGroupName = null ) : boolean
$email string User email
$parentGroupName string User group name to search inside
Результат boolean true if it exists, false if not
    public function checkUserExistenceByEmail($email, $parentGroupName = null)
    {
        $existingUsers = $this->userService->loadUsersByEmail($email);
        if (count($existingUsers) == 0) {
            return false;
        }
        if ($parentGroupName) {
            foreach ($existingUsers as $user) {
                $userGroups = $this->userService->loadUserGroupsOfUser($user);
                foreach ($userGroups as $userGroup) {
                    if ($userGroup->getFieldValue('name') == $parentGroupName) {
                        return true;
                    }
                }
            }
        }
        return false;
    }