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

Error when adding entry to existing order #538

Closed
tricki opened this issue Dec 10, 2024 · 3 comments
Closed

Error when adding entry to existing order #538

tricki opened this issue Dec 10, 2024 · 3 comments
Assignees

Comments

@tricki
Copy link

tricki commented Dec 10, 2024

I wanted to add an additional entry but when saving the order I got this error:

acclaro\translations\services\ElementTranslator::getWordCount(): Argument #1 ($element) must be of type craft\base\Element, null given, called in /app/vendor/acclaro/translations/src/services/repository/FileRepository.php on line 354

The problem is here: https://github.com/AcclaroInc/craft-translations/blob/master/src/services/repository/FileRepository.php#L354-L355

The getElementById method should also be passed a source site. When not passed, it uses the primary site, and unfortunately my entry doesn't exist there.

Here's my suggested fix (adding $order->sourceSite):

$element = Translations::$plugin->elementRepository->getElementById($elementId, $order->sourceSite);

I believe the same error would also be thrown on line 387: https://github.com/AcclaroInc/craft-translations/blob/master/src/services/repository/FileRepository.php#L387

@sidedwards
Copy link
Collaborator

We'll look into this; thanks for reporting!

@MerrittBoydston
Copy link
Collaborator

Hi @tricki - we have a release that should fix this.

Will you please test this for us on your end and confirm the fix?

@MerrittBoydston
Copy link
Collaborator

Hi @tricki - following up on my comment from last week. Please let us know if this is fixed on your end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants