Remove users from the team.

@param ArrayCollection $users

@return void
545777
public function removeUsers(ArrayCollection $users)
    {
        foreach ($users as $user) {
            $user->removeTeam($this);
            $this->users->removeElement($user);
        }
    }
702071
public function removeApps(ArrayCollection $apps)
    {
        foreach ($apps as $app) {
            $app->removePage($this);
            $this->apps->removeElement($app);
        }
    }
1237757
public function removeUserGroups(UserGroup ...$groups)
    {
        foreach ($groups as $group) {
            $this->getUserGroups()->removeElement($group);
        }

        return $this;
    }
569377
public function resetAdminRights($users)
    {
        foreach ($this->makeTraversable($users) as $user) {
            $this->doResetAdminRights($user);
        }
    }
1177957
public function drop($collection)
    {
        if (!$this->collections->containsKey($collection)) {
            return false;
        }

        $this->collections->get($collection)->drop();
        $this->collections->remove($collection);

        return true;
    }
1051898
public function leaveTeam($teamId, $userId)
    {
        $team = $this->team->find($teamId);
        $user = $this->model->find($userId);

        $user->teams()->detach($team);
    }
402738
public function removeUser(\FOM\UserBundle\Entity\User $user)
    {
        $this->users->removeElement($users);
    }
686032
public function dropCollection($collection)
    {
        $this->beginProfile($token = "    > drop collection " . $this->composeCollectionLogName($collection) . " ...");
        $this->db->getCollection($collection)->drop();
        $this->endProfile($token);
    }
231653
public function deleteTeams(array $teams)
    {
        $this->om->startFlushSuite();

        foreach ($teams as $team) {
            $this->deleteTeam($team);
        }

        $this->om->endFlushSuite();
    }
1133928
private function removeFromCollection(&$collection, $items)
    {
        if (is_array($collection)) {
            foreach ($items as $item) {
                foreach ($collection as $index => $v) {
                    if (spl_object_hash($item) == spl_object_hash($v)) {
                        unset($collection[$index]);
                    }
                }
            }
        } else {
            foreach ($items as $item) {
                $collection->removeElement($item);
            }
        }
    }
1022279
public static function delete_group_members($members) {
        global $CFG, $DB;
        require_once("$CFG->dirroot/group/lib.php");

        $params = self::validate_parameters(self::delete_group_members_parameters(), array('members'=>$members));

        $transaction = $DB->start_delegated_transaction();

        foreach ($params['members'] as $member) {
            // validate params
            $groupid = $member['groupid'];
            $userid = $member['userid'];

            $group = groups_get_group($groupid, '*', MUST_EXIST);
            $user = $DB->get_record('user', array('id'=>$userid, 'deleted'=>0, 'mnethostid'=>$CFG->mnet_localhost_id), '*', MUST_EXIST);

            // now security checks
            $context = context_course::instance($group->courseid, IGNORE_MISSING);
            try {
                self::validate_context($context);
            } catch (Exception $e) {
                $exceptionparam = new stdClass();
                $exceptionparam->message = $e->getMessage();
                $exceptionparam->courseid = $group->courseid;
                throw new moodle_exception('errorcoursecontextnotvalid' , 'webservice', '', $exceptionparam);
            }
            require_capability('moodle/course:managegroups', $context);

            if (!groups_remove_member_allowed($group, $user)) {
                throw new moodle_exception('errorremovenotpermitted', 'group', '', fullname($user));
            }
            groups_remove_member($group, $user);
        }

        $transaction->allow_commit();
    }
848283
public function deleteForce(array $userIds): void
    {
        $deleted = $this->getRepository()->deleteForce($userIds);

        event(new HCUserForceDeleted($deleted));
    }
47363
private function deleteAuthtokens(Entity\Users $user)
    {
        /** @var Repository\AuthtokenRepository $repo */
        $repo = $this->em->getRepository(Entity\Authtoken::class);
        $repo->deleteTokens($user->getId());
    }
843562
public function dropAllIndexes($collection)
    {
        $this->beginProfile($token = "    > drop all indexes on " . $this->composeCollectionLogName($collection) . ") ...");
        $this->db->getCollection($collection)->dropAllIndexes();
        $this->endProfile($token);
    }
481431
public function remove($ids)
    {
        if (!$this->isEmpty() &&
            ($remove = $this->_resolveIds($ids))) {
            $this->_ids = array_diff($this->_ids, array_unique($remove));
        }
    }
118959
protected function deleteCollection()
    {
        $this->controlAccess('collection_delete');

        if ($this->collection->delete($this->data_collection['collection_id'])) {
            $this->redirect('admin/content/collection', $this->text('Collection has been deleted'), 'success');
        }

        $this->redirect('', $this->text('Collection has not been deleted'), 'warning');
    }
382465
public function _cleanup(&$collection)
    {
        $name = $this->name();

        if ($this->isMany()) {
            foreach ($collection as $index => $entity) {
                if (is_object($entity)) {
                    $entity->{$name} = [];
                } else {
                    $collection[$index][$name] = [];
                }
            }
            return;
        }

        foreach ($collection as $index => $entity) {
            if (is_object($entity)) {
                unset($entity->{$name});
            } else {
                unset($entity[$name]);
            }
        }
    }