Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.x]: Error saving OrderHistory, userId must be initialized #3858

Open
rvgool-oym opened this issue Jan 22, 2025 · 1 comment
Open

[4.x]: Error saving OrderHistory, userId must be initialized #3858

rvgool-oym opened this issue Jan 22, 2025 · 1 comment
Labels
bug commerce4 Issues related to Commerce v4 Craft Commerce

Comments

@rvgool-oym
Copy link

What happened?

Description

When updating an Order Status through the console we are currently facing the following exception:
Typed property craft\commerce\models\OrderHistory::$userId must not be accessed before initialization

This is a result by a previous fix that only sets the userId when the request is not a console-request (be857b5)

Therefor when doing the following, we get the error mentioned above.

$order = ...
$order->orderStatusId = $statusCompletedId;
Craft::$app->getElements()->saveElement($order);

Craft CMS version

4.13.8

Craft Commerce version

4.7.2

PHP version

8.3

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

@rvgool-oym rvgool-oym added bug commerce4 Issues related to Commerce v4 Craft Commerce labels Jan 22, 2025
Copy link

linear bot commented Jan 22, 2025

PT-2394 [4.x]:

@rvgool-oym rvgool-oym changed the title [4.x]: [4.x]: Error saving OrderHistory, userId must be initialized Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug commerce4 Issues related to Commerce v4 Craft Commerce
Projects
None yet
Development

No branches or pull requests

1 participant