The $allowedFields property is there to protect against mass assignment attacks. Allowing a primary key in there would, in careless code, allow a user to submit an id with a form and have the id updated. Something that definitely needs to be guarded against. AllowedFields does not stop you from assigning that value individually, though, so you could do something like:
PHP Code:
$userArray = [
'key' => snowFlakeId(), //primaryKey
'userName' => 'XXXX',
];
$user = new UserEntity($userArray);
$user->key = snowFlakeId();
$this->userModel->save($user);
Another option is to not have the snowflake ID as the primary key. Keep an autoincrementing id as the primary, and then have a snowflake column, or something with the id. Put an index on that column and then do your finds by that column instead of the primary key. This would simplify your code a little since you wouldn't have to work around the mass assignment issue.