本文整理汇总了PHP中DatabaseHandler::createUpdateQuery方法的典型用法代码示例。如果您正苦于以下问题:PHP DatabaseHandler::createUpdateQuery方法的具体用法?PHP DatabaseHandler::createUpdateQuery怎么用?PHP DatabaseHandler::createUpdateQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DatabaseHandler
的用法示例。
在下文中一共展示了DatabaseHandler::createUpdateQuery方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateRole
/**
* Update role
*
* @throws \eZ\Publish\Core\Base\Exceptions\NotFoundException
*
* @param \eZ\Publish\SPI\Persistence\User\RoleUpdateStruct $role
*/
public function updateRole(RoleUpdateStruct $role)
{
$query = $this->handler->createUpdateQuery();
$query->update($this->handler->quoteTable('ezrole'))->set($this->handler->quoteColumn('name'), $query->bindValue($role->identifier))->where($query->expr->eq($this->handler->quoteColumn('id'), $query->bindValue($role->id, null, \PDO::PARAM_INT)));
$statement = $query->prepare();
$statement->execute();
if ($statement->rowCount() < 1) {
throw new NotFoundException('role', $role->id);
}
}
示例2: publishRoleDraft
/**
* Publish the specified role draft.
*
* @param mixed $roleId
*/
public function publishRoleDraft($roleId)
{
$query = $this->handler->createUpdateQuery();
$query->update($this->handler->quoteTable('ezrole'))->set($this->handler->quoteColumn('version'), $query->bindValue(Role::STATUS_DEFINED, null, \PDO::PARAM_INT))->where($query->expr->eq($this->handler->quoteColumn('id'), $query->bindValue($roleId, null, \PDO::PARAM_INT)));
$statement = $query->prepare();
$statement->execute();
$policyQuery = $this->handler->createUpdateQuery();
$policyQuery->update($this->handler->quoteTable('ezpolicy'))->set($this->handler->quoteColumn('original_id'), $policyQuery->bindValue(Role::STATUS_DEFINED, null, \PDO::PARAM_INT))->where($policyQuery->expr->lAnd($policyQuery->expr->eq($this->handler->quoteColumn('role_id'), $policyQuery->bindValue($roleId, null, \PDO::PARAM_INT)), $policyQuery->expr->eq($this->handler->quoteColumn('original_id'), $policyQuery->bindValue(Role::STATUS_DRAFT, null, \PDO::PARAM_INT))));
$queryStatement = $policyQuery->prepare();
$queryStatement->execute();
}