/** * Deletes the UrlWildcard with given $id * * @param mixed $id * * @return void */ public function deleteUrlWildcard($id) { /** @var $query \ezcQueryDelete */ $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(); }
/** * Remove all limitations for a policy * * @param mixed $policyId * * @return void */ 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(); } }
/** * 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(); }
/** * Remove role from user * * @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(); }