Deletes single custom alias row matched by composite primary key.

If $id is set only autogenerated entries will be removed.

@param mixed $parentId
@param string $textMD5

@return bool
332098
public function removeCustomAlias($parentId, $textMD5)
    {
        try {
            return $this->innerGateway->removeCustomAlias($parentId, $textMD5);
        } catch (DBALException $e) {
            throw new \RuntimeException('Database error', 0, $e);
        } catch (PDOException $e) {
            throw new \RuntimeException('Database error', 0, $e);
        }
    }
382696
public function removeMenuItem($alias, $parent = null)
    {
        if ($parent !== null) {
            if (!isset($this->_menuItems[$parent]) ||
                !isset($this->_menuItems[$parent]['children']) ||
                !isset($this->_menuItems[$parent]['children'][$alias])
            ) {
                return;
            }
            unset($this->_menuItems[$parent]['children'][$alias]);
            return;
        }

        if (!isset($this->_menuItems[$alias])) {
            return;
        }
        unset($this->_menuItems[$alias]);
    }
933126
private void removeEntry(CmsUUID entryId, CmsUUID parentId) {

        CmsClientSitemapEntry entry = getEntryById(entryId);
        CmsClientSitemapEntry deleteParent = getEntryById(parentId);
        removeAllChildren(entry);
        deleteParent.removeSubEntry(entry.getPosition());
        m_entriesById.remove(entryId);
        m_entriesByPath.remove(entry.getSitePath());
        // apply to detailpage table
        CmsDetailPageTable detailPageTable = getData().getDetailPageTable();
        if (detailPageTable.contains(entryId)) {
            detailPageTable.remove(entryId);
        }
    }
319832
public function delete($id = null)
    {
        $result = parent::delete($id);

        $this->handler->setBuilder($this)
            ->invalidateQuery(Reflector::QUERY_TYPE_DELETE, [Reflector::PRIMARY_KEY_COLUMN => $id]);

        return $result;
    }
650334
public function addParents($term_id, array $parent_ids)
    {
        $this->testCanAddParents($term_id, count($parent_ids));

        foreach ($parent_ids as $id) {
            $this->termHierarchyRepository->addParent($term_id, $id);
        }
    }
137929
public function deleteById($id)
	{
		$sql = "DELETE FROM `$this->tableName` WHERE `$this->pkColName` = :entityId ";

		$stmt = $this->pdo->prepare($sql);
		$stmt->bindParam(':entityId', intval($id), \PDO::PARAM_INT);
		$res = $stmt->execute();

		return ($res !== false && $stmt->rowCount() === 1);
	}
339075
public function load($parentID = null)
    {
        if ($parentID !== null) {
            $this->parentID = $parentID;
        }
        if ( ! is_array($rows = $this->selFromDbAll())) {
            return false;
        }

        if ( ! $this->fillItems($rows)) {
            return false;
        }

        return true;
    }
483149
protected function _changeParent(Model $model, $id = null, $parentId = null) {
		$parentField = $this->_getBehaviorConfig($model, 'parent');
		if (empty($id) || ($parentField === null)) {
			return false;
		}

		$model->recursive = -1;
		$treeItem = $model->read(null, $id);
		if (empty($treeItem)) {
			return false;
		}

		$treeItem[$model->alias][$parentField] = $parentId;
		$result = (bool)$model->save($treeItem);

		return $result;
	}
1223818
public function _cascadeDelete($parentTableClassname, array $primaryKey)
    {
        $this->_setupMetadata();
        $rowsAffected = 0;
        foreach ($this->_getReferenceMapNormalized() as $map) {
            if ($map[self::REF_TABLE_CLASS] == $parentTableClassname && isset($map[self::ON_DELETE])) {
                switch ($map[self::ON_DELETE]) {
                    case self::CASCADE:
                        $where = array();
                        for ($i = 0; $i < count($map[self::COLUMNS]); ++$i) {
                            $col = $this->_db->foldCase($map[self::COLUMNS][$i]);
                            $refCol = $this->_db->foldCase($map[self::REF_COLUMNS][$i]);
                            $type = $this->_metadata[$col]['DATA_TYPE'];
                            $where[] = $this->_db->quoteInto(
                                $this->_db->quoteIdentifier($col, true) . ' = ?',
                                $primaryKey[$refCol], $type);
                        }
                        $rowsAffected += $this->delete($where);
                        break;
                    default:
                        // no action
                        break;
                }
            }
        }
        return $rowsAffected;
    }
1106418
public function archiveUrlAliasesForDeletedTranslations($locationId, $parentId, array $languageIds)
    {
        // determine proper parent for linking historized entry
        $existingLocationEntry = $this->loadAutogeneratedEntry(
            'eznode:' . $locationId,
            $parentId
        );

        // filter existing URL alias entries by any of the specified removed languages
        $rows = $this->loadLocationEntriesMatchingMultipleLanguages(
            $locationId,
            $languageIds
        );

        // remove specific languages from a bit mask
        foreach ($rows as $row) {
            // filter mask to reduce the number of calls to storage engine
            $rowLanguageMask = (int) $row['lang_mask'];
            $languageIdsToBeRemoved = array_filter(
                $languageIds,
                function ($languageId) use ($rowLanguageMask) {
                    return $languageId & $rowLanguageMask;
                }
            );

            if (empty($languageIdsToBeRemoved)) {
                continue;
            }

            // use existing entry to link archived alias or use current alias id
            $linkToId = !empty($existingLocationEntry) ? $existingLocationEntry['id'] : $row['id'];
            foreach ($languageIdsToBeRemoved as $languageId) {
                $this->archiveUrlAliasForDeletedTranslation(
                    $row['lang_mask'],
                    $languageId,
                    $row['parent'],
                    $row['text_md5'],
                    $linkToId
                );
            }
        }
    }
595151
public static function DeleteParent($id) {
		$getparent = Dep::where('parent', '=', $id)->get();
		foreach ($getparent as $parent) {
			$check = Dep::find($parent->id);

			if ($check->parent > 0) {
				self::DeleteParent($check->id);
				@Up::del_icon($check->icon);
				$check->delete();
			} else {
				@Up::del_icon($check->icon);
				$check->delete();
			}

		}
	}
378848
public function removeInBelongsToManyRelationship(string $parentId, string $name, iterable $childIds): int
    {
        // Check that relationship is `BelongsToMany`
        assert(call_user_func(function () use ($name): bool {
            $relType = $this->getModelSchemas()->getRelationshipType($this->getModelClass(), $name);
            $errMsg  = "Relationship `$name` of class `" . $this->getModelClass() .
                '` either is not `belongsToMany` or do not exist in the class.';
            $isOk = $relType === RelationshipTypes::BELONGS_TO_MANY;

            assert($isOk, $errMsg);

            return $isOk;
        }));

        return $this->removeInToManyRelationship($this->getConnection(), $parentId, $name, $childIds);
    }
943046
public static function queryByParent( $parentId, $parentType ) {

		$tableName = static::tableName();

		return self::queryWithModel()->where( "$tableName.parentId=:pid AND $tableName.parentType=:ptype", [ ':pid' => $parentId, ':ptype' => $parentType ] );
	}
996436
public function aForm($id, $parentid)
    {
        $this->form->create(
            ["id" => __CLASS__, "legend" => "Gör ett inlägg",],
            [
                "title" => ["type"  => "text", "label" => "Titel","validation" => ["not_empty"]],
                "id" => ["type"  => "hidden", "value" => $id],
                "parentid" => ["type"  => "hidden", "value" => $parentid],
                "comment" => ["type"  => "textarea","label" => "Text","validation" => ["not_empty"]],
                "submit" => ["type" => "submit", "value" => "Spara", "callback" => [$this, "callbackSubmit"]],
            ]
        );
    }
990168
public function getParent($id)
    {
        if ($parent = $this->qb
            ->from($this->table)
            ->where($this->parentKey, $id)
            ->get(1)) {
            if ($parent->count() == 1) {
                return $parent;
            }
        }

        return false;
    }
1125781
private function getParentsIdRec($id, $className, $primaryKey, $parentIdField)
    {
        $parentId = (int)$className::find()->select($parentIdField)->where([ $primaryKey => $id ])->scalar();
        if ( $parentId ) {
            return array_merge(self::getParentsIdRec($parentId, $className, $primaryKey, $parentIdField), [$id]);
        } else {
            return [$id];
        }
    }
1287209
public function deleteByRoot( $rootId = null, array $except = array() )
    {
        if ( null === $rootId )
        {
            $where = array( new Predicate\IsNull(
                'rootParagraphId'
            ) );
        }
        else
        {
            $where = array(
                'rootParagraphId' => (int) $rootId,
            );
        }

        if ( ! empty( $except ) )
        {
            $where[] = new Predicate\NotIn( 'id', $except );
        }

        $delete = $this->sql()
                       ->delete()
                       ->where( $where );

        $result = $this->sql()
                       ->prepareStatementForSqlObject( $delete )
                       ->execute();

        return $result->getAffectedRows();
    }