Unverified Commit 0281f2ff authored by alexpott's avatar alexpott
Browse files

Issue #3097879 by andypost, longwave, Berdir, larowlan: Remove all @deprecated...

Issue #3097879 by andypost, longwave, Berdir, larowlan: Remove all @deprecated code in \Drupal\Core\Database
parent e1a041c4
......@@ -606,9 +606,7 @@ protected function filterComment($comment = '') {
public function query($query, array $args = [], $options = []) {
// Use default values if not already set.
$options += $this->defaultOptions();
if (isset($options['target'])) {
@trigger_error('Passing a \'target\' key to \\Drupal\\Core\\Database\\Connection::query $options argument is deprecated in Drupal 8.0.x and will be removed before Drupal 9.0.0. Instead, use \\Drupal\\Core\\Database\\Database::getConnection($target)->query(). See https://www.drupal.org/node/2993033.', E_USER_DEPRECATED);
}
assert(!isset($options['target']), 'Passing "target" option to query() has no effect. See https://www.drupal.org/node/2993033');
try {
// We allow either a pre-bound statement object or a literal string.
......
......@@ -486,30 +486,6 @@ public function dropField($table, $field) {
return TRUE;
}
/**
* {@inheritdoc}
*/
public function fieldSetDefault($table, $field, $default) {
@trigger_error('fieldSetDefault() is deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. Instead, call ::changeField() passing a full field specification. See https://www.drupal.org/node/2999035', E_USER_DEPRECATED);
if (!$this->fieldExists($table, $field)) {
throw new SchemaObjectDoesNotExistException(t("Cannot set default value of field @table.@field: field doesn't exist.", ['@table' => $table, '@field' => $field]));
}
$this->connection->query('ALTER TABLE {' . $table . '} ALTER COLUMN `' . $field . '` SET DEFAULT ' . $this->escapeDefaultValue($default));
}
/**
* {@inheritdoc}
*/
public function fieldSetNoDefault($table, $field) {
@trigger_error('fieldSetNoDefault() is deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. Instead, call ::changeField() passing a full field specification. See https://www.drupal.org/node/2999035', E_USER_DEPRECATED);
if (!$this->fieldExists($table, $field)) {
throw new SchemaObjectDoesNotExistException(t("Cannot remove default value of field @table.@field: field doesn't exist.", ['@table' => $table, '@field' => $field]));
}
$this->connection->query('ALTER TABLE {' . $table . '} ALTER COLUMN `' . $field . '` DROP DEFAULT');
}
/**
* {@inheritdoc}
*/
......
......@@ -696,32 +696,6 @@ public function dropField($table, $field) {
return TRUE;
}
/**
* {@inheritdoc}
*/
public function fieldSetDefault($table, $field, $default) {
@trigger_error('fieldSetDefault() is deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. Instead, call ::changeField() passing a full field specification. See https://www.drupal.org/node/2999035', E_USER_DEPRECATED);
if (!$this->fieldExists($table, $field)) {
throw new SchemaObjectDoesNotExistException(t("Cannot set default value of field @table.@field: field doesn't exist.", ['@table' => $table, '@field' => $field]));
}
$default = $this->escapeDefaultValue($default);
$this->connection->query('ALTER TABLE {' . $table . '} ALTER COLUMN "' . $field . '" SET DEFAULT ' . $default);
}
/**
* {@inheritdoc}
*/
public function fieldSetNoDefault($table, $field) {
@trigger_error('fieldSetNoDefault() is deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. Instead, call ::changeField() passing a full field specification. See https://www.drupal.org/node/2999035', E_USER_DEPRECATED);
if (!$this->fieldExists($table, $field)) {
throw new SchemaObjectDoesNotExistException(t("Cannot remove default value of field @table.@field: field doesn't exist.", ['@table' => $table, '@field' => $field]));
}
$this->connection->query('ALTER TABLE {' . $table . '} ALTER COLUMN "' . $field . '" DROP DEFAULT');
}
/**
* {@inheritdoc}
*/
......
......@@ -786,38 +786,6 @@ protected function introspectIndexSchema($table) {
return $schema;
}
/**
* {@inheritdoc}
*/
public function fieldSetDefault($table, $field, $default) {
@trigger_error('fieldSetDefault() is deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. Instead, call ::changeField() passing a full field specification. See https://www.drupal.org/node/2999035', E_USER_DEPRECATED);
if (!$this->fieldExists($table, $field)) {
throw new SchemaObjectDoesNotExistException(t("Cannot set default value of field @table.@field: field doesn't exist.", ['@table' => $table, '@field' => $field]));
}
$old_schema = $this->introspectSchema($table);
$new_schema = $old_schema;
$new_schema['fields'][$field]['default'] = $default;
$this->alterTable($table, $old_schema, $new_schema);
}
/**
* {@inheritdoc}
*/
public function fieldSetNoDefault($table, $field) {
@trigger_error('fieldSetNoDefault() is deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. Instead, call ::changeField() passing a full field specification. See https://www.drupal.org/node/2999035', E_USER_DEPRECATED);
if (!$this->fieldExists($table, $field)) {
throw new SchemaObjectDoesNotExistException(t("Cannot remove default value of field @table.@field: field doesn't exist.", ['@table' => $table, '@field' => $field]));
}
$old_schema = $this->introspectSchema($table);
$new_schema = $old_schema;
unset($new_schema['fields'][$field]['default']);
$this->alterTable($table, $old_schema, $new_schema);
}
/**
* {@inheritdoc}
*/
......
......@@ -612,13 +612,6 @@ public function leftJoin($table, $alias = NULL, $condition = NULL, $arguments =
return $this->addJoin('LEFT OUTER', $table, $alias, $condition, $arguments);
}
/**
* {@inheritdoc}
*/
public function rightJoin($table, $alias = NULL, $condition = NULL, $arguments = []) {
return $this->addJoin('RIGHT OUTER', $table, $alias, $condition, $arguments);
}
/**
* {@inheritdoc}
*/
......
......@@ -372,13 +372,6 @@ public function leftJoin($table, $alias = NULL, $condition = NULL, $arguments =
return $this->query->leftJoin($table, $alias, $condition, $arguments);
}
/**
* {@inheritdoc}
*/
public function rightJoin($table, $alias = NULL, $condition = NULL, $arguments = []) {
return $this->query->rightJoin($table, $alias, $condition, $arguments);
}
/**
* {@inheritdoc}
*/
......
......@@ -317,40 +317,6 @@ public function innerJoin($table, $alias = NULL, $condition = NULL, $arguments =
*/
public function leftJoin($table, $alias = NULL, $condition = NULL, $arguments = []);
/**
* Right Outer Join against another table in the database.
*
* @param $table
* The table against which to join. May be a string or another SelectQuery
* object. If a query object is passed, it will be used as a subselect.
* Unless the table name starts with the database / schema name and a dot
* it will be prefixed.
* @param $alias
* The alias for the table. In most cases this should be the first letter
* of the table, or the first letter of each "word" in the table.
* @param $condition
* The condition on which to join this table. If the join requires values,
* this clause should use a named placeholder and the value or values to
* insert should be passed in the 4th parameter. For the first table joined
* on a query, this value is ignored as the first table is taken as the base
* table. The token %alias can be used in this string to be replaced with
* the actual alias. This is useful when $alias is modified by the database
* system, for example, when joining the same table more than once.
* @param $arguments
* An array of arguments to replace into the $condition of this join.
* @return
* The unique alias that was assigned for this table.
*
* @deprecated in drupal:8.1.0 and is removed from drupal:9.0.0. Instead,
* change the query to use leftJoin(). For instance:
* $injected_connection->query('A')->rightJoin('B') is identical to
* $injected_connection->query('B')->leftJoin('A'). This functionality has
* been deprecated because SQLite does not support it.
*
* @see https://www.drupal.org/node/2765249
*/
public function rightJoin($table, $alias = NULL, $condition = NULL, $arguments = []);
/**
* Join against another table in the database.
*
......
......@@ -342,44 +342,6 @@ abstract public function addField($table, $field, $spec, $keys_new = []);
*/
abstract public function dropField($table, $field);
/**
* Set the default value for a field.
*
* @param $table
* The table to be altered.
* @param $field
* The field to be altered.
* @param $default
* Default value to be set. NULL for 'default NULL'.
*
* @throws \Drupal\Core\Database\SchemaObjectDoesNotExistException
* If the specified table or field doesn't exist.
*
* @deprecated in drupal:8.7.0 and is removed from drupal:9.0.0. Instead,
* call ::changeField() passing a full field specification.
*
* @see ::changeField()
*/
abstract public function fieldSetDefault($table, $field, $default);
/**
* Set a field to have no default value.
*
* @param $table
* The table to be altered.
* @param $field
* The field to be altered.
*
* @throws \Drupal\Core\Database\SchemaObjectDoesNotExistException
* If the specified table or field doesn't exist.
*
* @deprecated in drupal:8.7.0 and is removed from drupal:9.0.0. Instead,
* call ::changeField() passing a full field specification.
*
* @see ::changeField()
*/
abstract public function fieldSetNoDefault($table, $field);
/**
* Checks if an index exists in the given table.
*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment