Detach a tag(s) from an Ontraport Object(s).

@param  mixed  $ids
@param  mixed $tags
@return array
546979
public function untag($ids, $tags)
    {
        $namespace = $this->getNamespace() . '/tag';

        return $this->ontraport->delete($namespace, $this->toArray([
            'ids' => implode(',', (array) $ids),
            'remove_list' => implode(',', (array) $tags),
        ]));
    }
141618
public function removeByTag($tags, $byIntersect = false) {
		$backend = $this->getBackend();
		
		if (! $backend instanceof TaggableInterface) {
			throw new NoTagsSupported('Unable to remove a data by the tag(s) due to the tags does not supported by the backend "' . get_class($backend) . '"');
		}
		
		if (is_array($tags)) {
			$tags = array_map([$this, 'prepareId'], $tags);
		} else {
			$tags = $this->prepareId($tags);
		}
		
		return $backend->removeByTag($tags, $byIntersect);
	}
918793
public function removeMany(array $ids) {
		$result = true;
		
		foreach ($ids as $id) {
			if (! apc_delete($id)) {
				$result = false;
			}
		}
		
		return $result;
	}
339670
public function several(array $ids)
    {
        $result = [];
        foreach ($ids as $id) {
            if ($this->has($id)) {
                $result[$id] = $this->get($id);
            }
        }
        return $result;

    }
1319480
public function delete($ids)
    {
        $ids = json_decode($ids);
        if (is_array($ids))
            $nbDeleted = $this->getAlertDataHandler()->removeAlerts(array_values($ids));
        $deleted = array(
            "deleted" => $nbDeleted
        );
        $response = $this->getResponse();
        $response->getHeaders()->addHeaderLine('Content-Type', 'application/json');
        $serializer = $this->getSerializer();
        $alertssJson = $serializer->serialize($deleted, 'json');
        $response->setContent($alertssJson);
        return $response;
    }
377831
public function deleteByIdArray(array $ids)
    {
        $data['ids'] = $ids;

        $deleteResult = $this->getRequest()->request(
            'DELETE',
            $this->getRequestUrl('inputs'),
            $data
        );

        return $deleteResult['status'];
    }
811034
public function untag($tags = null)
    {
        if (empty($tags)) {
            return $this->_updateTags([], 'replace');
        }

        $table = TableRegistry::getTableLocator()->get($this->source());
        $behavior = $table->behaviors()->Tag;
        $assoc = $table->getAssociation($behavior->getConfig('tagsAlias'));
        $property = $assoc->getProperty();
        $id = $this->get($table->getPrimaryKey());
        $untags = $behavior->normalizeTags($tags);

        $tags = $this->get($property);
        if (!$tags) {
            $contain = [$behavior->getConfig('tagsAlias')];
            $tags = $table->get($id, compact('contain'))->get($property);
        }

        $tagsTable = $table->{$behavior->getConfig('tagsAlias')};
        $pk = $tagsTable->getPrimaryKey();
        $df = $tagsTable->getDisplayField();

        foreach ($tags as $k => $tag) {
            $tags[$k] = [
                $pk => $tag->{$pk},
                $df => $tag->{$df},
            ];
        }

        foreach ($untags as $untag) {
            foreach ($tags as $k => $tag) {
                if ((empty($untag[$pk]) || $tag[$pk] === $untag[$pk]) &&
                    (empty($untag[$df]) || $tag[$df] === $untag[$df])
                ) {
                    unset($tags[$k]);
                }
            }
        }

        return $this->_updateTags(
            array_map(
                function ($i) {
                    return implode(':', $i);
                },
                $tags
            ),
            'replace'
        );
    }
593450
public function syncTags($tags)
    {
        /** @var Tag $className */
        $className = static::getTagClassName();

        $tags = collect($className::findOrCreate($tags));

        $this->tags()->sync($tags->pluck('id')->toArray());

        return $this;
    }
670278
public function detachPermissions(array $ids, $reload = true)
    {
        event(new DetachingPermissionsFromGroup($this, $ids));
        $detached = $this->permissions()->whereIn('id', $ids)->update(['group_id' => 0]);
        event(new DetachedPermissionsFromGroup($this, $ids, $detached));

        $this->loadPermissions($reload);

        return $detached;
    }
1309198
public function detachMediaTags($tags)
    {
        $this->media()->newPivotStatement()
            ->where($this->media()->getMorphType(), $this->media()->getMorphClass())
            ->where($this->mediaQualifiedForeignKey(), $this->getKey())
            ->whereIn('tag', (array) $tags)->delete();
        $this->markMediaDirty($tags);
    }
101019
public function tag($tags)
    {
        $tags = $this->makeTagsArray($tags);

        $this->addTags($tags);

        if (count($tags) > 0) {
            $this->tags()->sync(
                Tag::whereIn('tag', $tags)->pluck('id')->all()
            );

            return;
        }

        $this->tags()->detach();
    }
819195
public function tags($tags = null)
    {
        $this->cacheTags = $tags === false ? false : $tags;
        return $this;
    }
1230686
public function sync($ids, $detaching = true)
    {
        $changes = array(
            'attached' => array(), 'detached' => array(), 'updated' => array()
        );

        // get them as collection
        if ($ids instanceof Collection) $ids = $ids->modelKeys();

        // First we need to attach the relationships that do not exist
        // for this model so we'll spin throuhg the edges of this model
        // for the specified type regardless of the direction and create
        // those that do not exist.

        // Let's fetch the existing edges first.
        $edges = $this->edges();
        // Collect the current related models IDs out of related models.
        $current = array_map(function(Relation $edge){ return $edge->getRelated()->getKey(); }, $edges->toArray());

        $records = $this->formatSyncList($ids);

        $detach = array_diff($current, array_keys($records));

        // Next, we will take the differences of the currents and given IDs and detach
        // all of the entities that exist in the "current" array but are not in the
        // the array of the IDs given to the method which will complete the sync.
        if ($detaching && count($detach) > 0)
        {
            $this->detach($detach);

            $changes['detached'] = (array) array_map('intval', $detach);
        }

        // Now we are finally ready to attach the new records. Note that we'll disable
        // touching until after the entire operation is complete so we don't fire a
        // ton of touch operations until we are totally done syncing the records.
        $changes['attached'] = $records;
        $changes['updated']  = $current;

        // Now we are finally ready to attach the new records. Note that we'll disable
        // touching until after the entire operation is complete so we don't fire a
        // ton of touch operations until we are totally done syncing the records.
        $changes = array_merge(
            $changes, $this->attachNew($records, $current, false)
        );

        $this->touchIfTouching();

        return $changes;
    }
102867
protected function getTagData($tags, $byIntersect = false) {
		if (is_array($tags)) {
			$tagsData = $this->getTagHolderBackend()->getMany($tags);
			
			if (empty($tagsData)) {
				return;
			}
			
			if ($byIntersect) {
				$tagData = call_user_func_array('array_intersect', $tagsData);
				
				if (empty($tagData)) {
					return;
				}
			} else {
				$tagData = array_unique(call_user_func_array('array_merge', $tagsData));
			}
		} else {
			$tagData = $this->getTagHolderBackend()->get($tags);

			if (empty($tagData)) {
				return;
			}
		}
		
		return $tagData;
	}
1278430
public function syncTags($tags, bool $detaching = true)
    {
        $this->tags()->sync($this->parseTags($tags, null, null, true), $detaching);

        return $this;
    }
698745
public function getIdsMatchingTags($tags = array())
    {
        $first = true;
        $ids = array();
        foreach ($tags as $tag) {
            $res = $this->_query("SELECT DISTINCT(id) AS id FROM tag WHERE name='$tag'");
            if (!$res) {
                return array();
            }
            $rows = @sqlite_fetch_all($res, SQLITE_ASSOC);
            $ids2 = array();
            foreach ($rows as $row) {
                $ids2[] = $row['id'];
            }
            if ($first) {
                $ids = $ids2;
                $first = false;
            } else {
                $ids = array_intersect($ids, $ids2);
            }
        }
        $result = array();
        foreach ($ids as $id) {
            $result[] = $id;
        }
        return $result;
    }
582747
private function _mangleTags($tags)
    {
        foreach ($tags as $i => $tag) {
            $tags[$i] = $this->_mangleTag($tag);
        }
        return $tags;
    }