Entities/Roles/Model/RolesTableMapper.php
public function getRoleIdsForRoles(array $roles): array 
    {
        if (count($roles) == 0) {
            throw new \InvalidArgumentException("Roles array must be populated.");
        }
    
        $roleIds = [];

        foreach ($roles as $role) {
            if (null === $roleIds[] = $this->getRoleIdForRole($role)) {
                throw new \InvalidArgumentException("Role $role does not exist");
            }
        }
    
        return $roleIds;
    }
public function getRoleIdsForRoles(array $roles): array 
    {
        if (count($roles) == 0) {
            throw new \InvalidArgumentException("Roles array must be populated.");
        }
    
        $roleIds = [];

        foreach ($roles as $role) {
            if (null === $roleIds[] = $this->getRoleIdForRole($role)) {
                throw new \InvalidArgumentException("Role $role does not exist");
            }
        }
    
        return $roleIds;
    }
all roles must exist or exception thrown