function FetchModeTrait::assocIntoObject

Fills an object with data from a FETCH_ASSOC row.

Parameters

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

object $object: The object receiving the data.

Return value

object The object receiving the data.

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 151

Class

FetchModeTrait
Provide helper methods for statement fetching.

Namespace

Drupal\Core\Database

Code

protected function assocIntoObject(array $rowAssoc, object $object) : object {
    @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);
    foreach ($rowAssoc as $column => $value) {
        $object->{$column} = $value;
    }
    return $object;
}

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