本文整理匯總了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();
}