Remove all contact records

@param bool $with_groups Delete also groups if enabled
553969
function delete_all($with_groups = false)
    {
        // searching for contact entries
        $dn_list = $this->ldap->list_entries($this->base_dn, $this->prop['filter'] ?: '(objectclass=*)');

        if (!empty($dn_list)) {
            foreach ($dn_list as $idx => $entry) {
                $dn_list[$idx] = self::dn_encode($entry['dn']);
            }
            $this->delete($dn_list);
        }

        if ($with_groups && $this->groups && ($groups = $this->_fetch_groups()) && count($groups)) {
            foreach ($groups as $group) {
                $this->ldap->delete_entry($group['dn']);
            }

            if ($this->cache) {
                $this->cache->remove('groups');
            }
        }
    }
701824
public function removeFields($fieldset = null, $group = null)
    {
        foreach ($this->fields as $current) {
            if ($fieldset && $current->getFieldset() != $fieldset) {
                $this->removeField($current->getName(true));
            }

            if ($group && $current->getGroup() != $group) {
                $this->removeField($current->getName(true));
            }
        }

        return $this;
    }
1123609
public function delete(BulkOperation $bulk, Iterator $records)
    {
        foreach ($records as $record) {
            $bulk->delete([
                'id' => $record->getId(),
                'type' => self::TYPE_NAME
            ], null);
        }
    }
891424
public function remove( ...$with_keys ) : self {

		foreach ( $with_keys as $keys ) {
			foreach ( (array) $keys as $k ) {
				$this->offsetUnset( $k );
			}
		}

		return $this;
	}
51516
public function unsetUserGroups()
    {
        $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
        $sDelete = 'delete from oxobject2group where oxobjectid = ' . $oDb->quote($this->getId());
        $oDb->execute($sDelete);
    }
683834
public function deleteAddressBookContact($addressBookId, $contactId)
    {
        //Only if there is a contact id and address book id
        if ($addressBookId && $contactId) {
            $url = $this->getApiEndpoint() . self::REST_ADDRESS_BOOKS . $addressBookId
                . '/contacts/' . $contactId;
            $this->setUrl($url)
                ->setVerb('DELETE');
            $this->execute();
            $this->helper->log(sprintf('Delete-contact %s from addressbook %s', $contactId, $addressBookId));
        }
    }
644140
function remove_from_group($group_id, $ids)
    {
        if (!is_array($ids))
            $ids = explode(self::SEPARATOR, $ids);

        $ids = $this->db->array2list($ids, 'integer');

        $sql_result = $this->db->query(
            "DELETE FROM " . $this->db->table_name($this->db_groupmembers, true).
            " WHERE `contactgroup_id` = ?".
                " AND `contact_id` IN ($ids)",
            $group_id
        );

        return $this->db->affected_rows($sql_result);
    }
704946
function ContactsGroupsMembersDelete(options, groupId, contactId) {
    ActionAbstract.call(this, options);
    this._groupId = groupId;
    this._contactId = contactId;
}
375678
public function removeContact($contact_id = null, $id = null)
    {
        if (is_null($contact_id) || is_null($id)) {
            throw new InvalidArgumentException('Null Contact or Group id.');
        }
        $ResourceName = $this->resourceName . ($id ? '/' . $id . '/contacts/' . $contact_id : null);

        list($responseStatus, , $responseBody) = $this->HttpClient->performHttpRequest(
            Common\HttpClient::REQUEST_DELETE,
            $ResourceName
        );
        if ($responseStatus !== Common\HttpClient::HTTP_NO_CONTENT) {
            return json_decode($responseBody);
        }
    }
972667
public function removeGroup(GroupInterface $group)
	{
		if ($this->inGroup($group))
		{
			$this->groups()->detach($group);
			$this->invalidateUserGroupsCache();
			$this->invalidateMergedPermissionsCache();
		}

		return true;
	}
325214
public function deleteHistoryEntries($ids, $withFiles = true)
    {
        $params = [
            'name'      => 'delete',
            'del_files' => $withFiles,
            'value'     => implode(',', $ids)
        ];
        $url = $this->buildUrl('history', $params);

        $request = $this->guzzle->request('GET', $url);

        return json_decode($request->getBody(), true)['status'];
    }
779548
protected function resetSubGroups()
    {
        $reset = false;
        foreach ($this->parent->getGroups() as $group) {
            if ($reset) {
                $group->reset();
            }

            if ($group === $this) {
                $reset = true;
            }
        }
    }
895757
public function removeContact(int $index): void
    {
        unset($this->contacts[$index]);
        $this->contacts = array_values($this->contacts);
    }
1199299
public function removeGroup($id_group)
    {
        try {

            $this->db->beginTransaction();

            // Delete usergroup
            $this->db->qb([
                'table' => 'core_groups',
                'method' => 'DELETE',
                'filter' => 'id_group = :id_group',
                'params' => [
                    ':id_group' => $id_group
                ]
            ]);
            $this->db->execute();

            // Delete permissions related to this group
            $this->db->qb([
                'table' => 'core_permissions',
                'method' => 'DELETE',
                'filter' => 'id_group = :id_group',
                'params' => [
                    ':id_group' => $id_group
                ]
            ]);
            $this->db->execute();

            // Remove group from current grouplist
            unset($this->groups[$id_group]);

            $this->db->endTransaction();
        }
        catch (\PDOException $e) {

            $this->db->cancelTransaction();

            Throw new GroupException($e->getMessage(), $e->getCode(), $e->getPrevious());
        }
    }
877626
public function removeGroups(array $groupIds)
    {
        array_walk($groupIds, function(&$item) {$item = new \MongoId($item);});

        $this->createQueryBuilder()
            ->updateMany()
            ->field('id')->in($groupIds)
            ->field('deleted')->set(true)
            ->getQuery()
            ->execute();
    }
557546
public static function delete_groupings($groupingids) {
        global $CFG, $DB;
        require_once("$CFG->dirroot/group/lib.php");

        $params = self::validate_parameters(self::delete_groupings_parameters(), array('groupingids'=>$groupingids));

        $transaction = $DB->start_delegated_transaction();

        foreach ($params['groupingids'] as $groupingid) {

            if (!$grouping = groups_get_grouping($groupingid)) {
                // Silently ignore attempts to delete nonexisting groupings.
                continue;
            }

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

            groups_delete_grouping($grouping);
        }

        $transaction->allow_commit();
    }
441978
public function deleteServiceGroup($group)
    {
        $filename = $this->getConfigFilename($group);
        $this->getFilesystem()->remove($filename);

        // Unlike normal arrays, unset() will throw errors here if the key
        // doesn't exist.
        if (isset($this[$group])) {
            unset($this[$group]);
        }

        unset($this->removed[$group]);
    }