function FetchModeTrait::assocToBoth

Converts a row of data in FETCH_ASSOC format to FETCH_BOTH.

Parameters

array $rowAssoc: A row of data in FETCH_ASSOC format.

Return value

array The row in FETCH_BOTH format.

Deprecated

in drupal:10.2.0 and is removed from drupal:11.0.0. Use supported modes only.

See also

https://www.drupal.org/node/3377999

File

core/lib/Drupal/Core/Database/FetchModeTrait.php, line 59

Class

FetchModeTrait
Provide helper methods for statement fetching.

Namespace

Drupal\Core\Database

Code

protected function assocToBoth(array $rowAssoc) : array {
    @trigger_error(__METHOD__ . '() is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. Use supported modes only. See https://www.drupal.org/node/3377999', E_USER_DEPRECATED);
    // \PDO::FETCH_BOTH returns an array indexed by both the column name
    // and the column number.
    return $rowAssoc + array_values($rowAssoc);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.