Adding serialized data to users data column
Last updated on
30 April 2025
The users table has a "data" column which can store serialized data, but you cannot migrate into this field by doing a mapping, because the user migration doesn't provide the "data" field as a possible mapping destination.
Instead, you can add the serialized data in your migration by implementing the prepare() method, which operates on the created entity:
public function prepare(stdClass $account, stdClass $row) {
$account->data = array(
'field1' => $row->1,
'field2' => $row->2
);
}
(This information comes from cameronbprince at this issue. I have confirmed that it works.)
Help improve this page
Page status: Not set
You can:
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion