本文整理汇总了PHP中DatabaseHandler::quoteTable方法的典型用法代码示例。如果您正苦于以下问题:PHP DatabaseHandler::quoteTable方法的具体用法?PHP DatabaseHandler::quoteTable怎么用?PHP DatabaseHandler::quoteTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DatabaseHandler
的用法示例。
在下文中一共展示了DatabaseHandler::quoteTable方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
}