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

Fatal error when saving object with product-specific prices -> EntityMerger got object of wrong class #1864

Conversation

BlackbitDevs
Copy link
Contributor

@BlackbitDevs BlackbitDevs commented Feb 14, 2022

We had a problem that some product objects could not be saved anymore. Fatal Error

request.CRITICAL: Uncaught PHP Exception Symfony\Component\ErrorHandler\Error\UndefinedMethodError: "Attempted to call an undefined method named "setOwner" of class "Doctrine\Common\Collections\ArrayCollection"." at [Pimcore-Root>/vendor/coreshop/core-shop/src/CoreShop/Bundle/ResourceBundle/Doctrine/ORM/EntityMerger.php line 153 {"exception":"[object] (Symfony\Component\Debug\Exception\FatalThrowableError(code: 0): Attempted to call an undefined method named "setOwner" of class "Doctrine\Common\Collections\ArrayCollection". at [Pimcore-Root>/vendor/coreshop/core-shop/src/CoreShop/Bundle/ResourceBundle/Doctrine/ORM/EntityMerger.php:153)"} []
was thrown.

$newData = $class->reflFields[$assoc['fieldName']]->getValue($entity);

caused $newCollection to be a Doctrine\Common\Collections\ArrayCollection afterwards.

This PR backports the change to EntityMerger class from 97f743a - now object can be saved as normal.

@BlackbitDevs BlackbitDevs changed the base branch from master to 2.2 February 14, 2022 09:38
@dpfaffenbauer dpfaffenbauer self-requested a review February 14, 2022 13:47
@dpfaffenbauer dpfaffenbauer added this to the 2.2.12 milestone Feb 14, 2022
@dpfaffenbauer dpfaffenbauer merged commit f43a1b8 into coreshop:2.2 Feb 14, 2022
@dpfaffenbauer
Copy link
Member

thanks

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

Successfully merging this pull request may close these issues.

2 participants