本文整理汇总了PHP中eZ\Publish\Core\Persistence\Database\DatabaseHandler::createDeleteQuery方法的典型用法代码示例。如果您正苦于以下问题:PHP DatabaseHandler::createDeleteQuery方法的具体用法?PHP DatabaseHandler::createDeleteQuery怎么用?PHP DatabaseHandler::createDeleteQuery使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZ\Publish\Core\Persistence\Database\DatabaseHandler
的用法示例。
在下文中一共展示了DatabaseHandler::createDeleteQuery方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteUrlWildcard
/**
* Deletes the UrlWildcard with given $id.
*
* @param mixed $id
*/
public function deleteUrlWildcard($id)
{
/** @var $query \eZ\Publish\Core\Persistence\Database\DeleteQuery */
$query = $this->dbHandler->createDeleteQuery();
$query->deleteFrom($this->dbHandler->quoteTable('ezurlwildcard'))->where($query->expr->eq($this->dbHandler->quoteColumn('id'), $query->bindValue($id, null, \PDO::PARAM_INT)));
$query->prepare()->execute();
}
示例2: deleteRelation
/**
* Deletes the relation with the given $relationId.
*
* @param int $relationId
* @param int $type {@see \eZ\Publish\API\Repository\Values\Content\Relation::COMMON,
* \eZ\Publish\API\Repository\Values\Content\Relation::EMBED,
* \eZ\Publish\API\Repository\Values\Content\Relation::LINK,
* \eZ\Publish\API\Repository\Values\Content\Relation::FIELD}
*/
public function deleteRelation($relationId, $type)
{
// Legacy Storage stores COMMON, LINK and EMBED types using bitmask, therefore first load
// existing relation type by given $relationId for comparison
/** @var $query \eZ\Publish\Core\Persistence\Database\SelectQuery */
$query = $this->dbHandler->createSelectQuery();
$query->select($this->dbHandler->quoteColumn('relation_type'))->from($this->dbHandler->quoteTable('ezcontentobject_link'))->where($query->expr->eq($this->dbHandler->quoteColumn('id'), $query->bindValue($relationId, null, \PDO::PARAM_INT)));
$statement = $query->prepare();
$statement->execute();
$loadedRelationType = $statement->fetchColumn();
if (!$loadedRelationType) {
return;
}
// If relation type matches then delete
if ($loadedRelationType == $type) {
/** @var $query \eZ\Publish\Core\Persistence\Database\DeleteQuery */
$query = $this->dbHandler->createDeleteQuery();
$query->deleteFrom('ezcontentobject_link')->where($query->expr->eq($this->dbHandler->quoteColumn('id'), $query->bindValue($relationId, null, \PDO::PARAM_INT)));
$query->prepare()->execute();
} elseif ($loadedRelationType & $type) {
// If relation type is composite update bitmask
/** @var $query \eZ\Publish\Core\Persistence\Database\UpdateQuery */
$query = $this->dbHandler->createUpdateQuery();
$query->update($this->dbHandler->quoteTable('ezcontentobject_link'))->set($this->dbHandler->quoteColumn('relation_type'), $query->expr->bitAnd($this->dbHandler->quoteColumn('relation_type'), $query->bindValue(~$type, null, \PDO::PARAM_INT)))->where($query->expr->eq($this->dbHandler->quoteColumn('id'), $query->bindValue($relationId, null, \PDO::PARAM_INT)));
$query->prepare()->execute();
} else {
// No match, do nothing
}
}
示例3: deleteObjectWordsLink
/**
* Delete relation between a word and a content object.
*
* @param $contentId
*/
public function deleteObjectWordsLink($contentId)
{
$query = $this->dbHandler->createDeleteQuery();
$query->deleteFrom($this->dbHandler->quoteTable('ezsearch_object_word_link'))->where($query->expr->eq($this->dbHandler->quoteColumn('contentobject_id'), ':contentId'));
$stmt = $query->prepare();
$stmt->execute(['contentId' => $contentId]);
}
示例4: removePolicyLimitations
/**
* Remove all limitations for a policy.
*
* @param mixed $policyId
*/
public function removePolicyLimitations($policyId)
{
$query = $this->handler->createSelectQuery();
$query->select($this->handler->aliasedColumn($query, 'id', 'ezpolicy_limitation'), $this->handler->aliasedColumn($query, 'id', 'ezpolicy_limitation_value'))->from($this->handler->quoteTable('ezpolicy'))->leftJoin($this->handler->quoteTable('ezpolicy_limitation'), $query->expr->eq($this->handler->quoteColumn('policy_id', 'ezpolicy_limitation'), $this->handler->quoteColumn('id', 'ezpolicy')))->leftJoin($this->handler->quoteTable('ezpolicy_limitation_value'), $query->expr->eq($this->handler->quoteColumn('limitation_id', 'ezpolicy_limitation_value'), $this->handler->quoteColumn('id', 'ezpolicy_limitation')))->where($query->expr->eq($this->handler->quoteColumn('id', 'ezpolicy'), $query->bindValue($policyId, null, \PDO::PARAM_INT)));
$statement = $query->prepare();
$statement->execute();
$limitationIdsSet = array();
$limitationValuesSet = array();
while ($row = $statement->fetch(\PDO::FETCH_ASSOC)) {
if ($row['ezpolicy_limitation_id'] !== null) {
$limitationIdsSet[$row['ezpolicy_limitation_id']] = true;
}
if ($row['ezpolicy_limitation_value_id'] !== null) {
$limitationValuesSet[$row['ezpolicy_limitation_value_id']] = true;
}
}
if (!empty($limitationIdsSet)) {
$query = $this->handler->createDeleteQuery();
$query->deleteFrom($this->handler->quoteTable('ezpolicy_limitation'))->where($query->expr->in($this->handler->quoteColumn('id'), array_keys($limitationIdsSet)));
$query->prepare()->execute();
}
if (!empty($limitationValuesSet)) {
$query = $this->handler->createDeleteQuery();
$query->deleteFrom($this->handler->quoteTable('ezpolicy_limitation_value'))->where($query->expr->in($this->handler->quoteColumn('id'), array_keys($limitationValuesSet)));
$query->prepare()->execute();
}
}
示例5: remove
/**
* Deletes all rows with given $action and optionally $id.
*
* If $id is set only autogenerated entries will be removed.
*
* @param mixed $action
* @param mixed|null $id
*
* @return boolean
*/
public function remove($action, $id = null)
{
/** @var $query \eZ\Publish\Core\Persistence\Database\DeleteQuery */
$query = $this->dbHandler->createDeleteQuery();
$query->deleteFrom($this->dbHandler->quoteTable('ezurlalias_ml'))->where($query->expr->eq($this->dbHandler->quoteColumn("action"), $query->bindValue($action, null, \PDO::PARAM_STR)));
if ($id !== null) {
$query->where($query->expr->lAnd($query->expr->eq($this->dbHandler->quoteColumn("is_alias"), $query->bindValue(0, null, \PDO::PARAM_INT)), $query->expr->eq($this->dbHandler->quoteColumn("id"), $query->bindValue($id, null, \PDO::PARAM_INT))));
}
$query->prepare()->execute();
}
示例6: removeRole
/**
* Remove role from user or user group
*
* @param mixed $contentId
* @param mixed $roleId
*/
public function removeRole( $contentId, $roleId )
{
$query = $this->handler->createDeleteQuery();
$query
->deleteFrom( $this->handler->quoteTable( 'ezuser_role' ) )
->where(
$query->expr->lAnd(
$query->expr->eq(
$this->handler->quoteColumn( 'contentobject_id' ),
$query->bindValue( $contentId, null, \PDO::PARAM_INT )
),
$query->expr->eq(
$this->handler->quoteColumn( 'role_id' ),
$query->bindValue( $roleId, null, \PDO::PARAM_INT )
)
)
);
$query->prepare()->execute();
}
示例7: deleteTag
/**
* Deletes tag identified by $tagId, including its synonyms and all tags under it.
*
* If $tagId is a synonym, only the synonym is deleted
*
* @param mixed $tagId
*/
public function deleteTag($tagId)
{
$query = $this->handler->createSelectQuery();
$query->select('id')->from($this->handler->quoteTable('eztags'))->where($query->expr->lOr($query->expr->like($this->handler->quoteColumn('path_string'), $query->bindValue('%/' . (int) $tagId . '/%', null, PDO::PARAM_STR)), $query->expr->eq($this->handler->quoteColumn('main_tag_id'), $query->bindValue($tagId, null, PDO::PARAM_INT))));
$statement = $query->prepare();
$statement->execute();
$tagIds = array();
while ($row = $statement->fetch(PDO::FETCH_ASSOC)) {
$tagIds[] = (int) $row['id'];
}
if (empty($tagIds)) {
return;
}
$query = $this->handler->createDeleteQuery();
$query->deleteFrom($this->handler->quoteTable('eztags_attribute_link'))->where($query->expr->in($this->handler->quoteColumn('keyword_id'), $tagIds));
$query->prepare()->execute();
$query = $this->handler->createDeleteQuery();
$query->deleteFrom($this->handler->quoteTable('eztags_keyword'))->where($query->expr->in($this->handler->quoteColumn('keyword_id'), $tagIds));
$query->prepare()->execute();
$query = $this->handler->createDeleteQuery();
$query->deleteFrom($this->handler->quoteTable('eztags'))->where($query->expr->in($this->handler->quoteColumn('id'), $tagIds));
$query->prepare()->execute();
}
示例8: deleteGroupAssignmentsForType
/**
* Deletes all group assignments for a Type.
*
* @param mixed $typeId
* @param int $status
*
* @return void
*/
public function deleteGroupAssignmentsForType($typeId, $status)
{
$q = $this->dbHandler->createDeleteQuery();
$q->deleteFrom($this->dbHandler->quoteTable('ezcontentclass_classgroup'))->where($q->expr->lAnd($q->expr->eq($this->dbHandler->quoteColumn('contentclass_id'), $q->bindValue($typeId, null, \PDO::PARAM_INT)), $q->expr->eq($this->dbHandler->quoteColumn('contentclass_version'), $q->bindValue($status, null, \PDO::PARAM_INT))));
$q->prepare()->execute();
}
示例9: removeElementFromTrash
/**
* Removes trashed element identified by $id from trash.
* Will NOT remove associated content object nor attributes.
*
* @param int $id The trashed location Id
*/
public function removeElementFromTrash($id)
{
$query = $this->handler->createDeleteQuery();
$query->deleteFrom('ezcontentobject_trash')->where($query->expr->eq($this->handler->quoteColumn('node_id'), $query->bindValue($id, null, \PDO::PARAM_INT)));
$query->prepare()->execute();
}
示例10: deleteObjectStateGroupTranslations
/**
* Deletes all translations of the $groupId state group
*
* @param mixed $groupId
*/
protected function deleteObjectStateGroupTranslations($groupId)
{
$query = $this->dbHandler->createDeleteQuery();
$query->deleteFrom($this->dbHandler->quoteTable('ezcobj_state_group_language'))->where($query->expr->eq($this->dbHandler->quoteColumn('contentobject_state_group_id'), $query->bindValue($groupId, null, \PDO::PARAM_INT)));
$query->prepare()->execute();
}