-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Strange dirty behavior in PersistentCollection #5601
Comments
Can you make a gist containing the entities and persistance code leading to the error? |
@zeroedin-bill Updated :) |
Hmm. I haven't seen someone use interfaces as targetEntity before, but I really don't know what is going on here. @Ocramius, @guilhermeblanco, any ideas? |
@zeroedin-bill the resolve target entity does the work :) http://symfony.com/doc/current/cookbook/doctrine/resolve_target_entity.html |
ping @acasademont |
I got it. $categories = $product->getCategories();
$newCategories = new ArrayCollection();
foreach ($categories as $category) {
$newCategories->add($category);
}
$product->setCategories($newCategories); What happens here? I would love to understand why, so I will continue digging in the project, but if you can give me some light, would be nice :) @zeroedin-bill @Ocramius |
@mmoreram I think we'd really need a failing test case to fully understand what's going on here... |
Yes. That's what I working on now :) |
👍 |
* Using the new repository for purchasable instead of all single ones * Adapted store and templates for this change Fixes: * Class ProductHasOnlyOneCategoryEventListener fixed. Doctrine was crashing because of bad practice of collection setters. More information in doctrine/orm#5601 * Fixtures restarted. No one resultant fixtures cannot be applied when there is some data. Code: * Code has changed in order to establish a new relation between the project and elcodi updates. * All admin pages, twig templates and forms have been created * Store have changed in order to work with new implementation * Some names were explicitely refering to product instead of purchasable. This has changed. * Using purchasable_name and valid_image twig extensions in store template Tests: * Some tests have been redone. All of them were testing behavior, and because some urls have been changed, for example, these scenarios have been changed. * Added some entries in Visithor and fixed old ones
* Using the new repository for purchasable instead of all single ones * Adapted store and templates for this change Fixes: * Class ProductHasOnlyOneCategoryEventListener fixed. Doctrine was crashing because of bad practice of collection setters. More information in doctrine/orm#5601 * Fixtures restarted. No one resultant fixtures cannot be applied when there is some data. Code: * Code has changed in order to establish a new relation between the project and elcodi updates. * All admin pages, twig templates and forms have been created * Store have changed in order to work with new implementation * Some names were explicitely refering to product instead of purchasable. This has changed. * Using purchasable_name and valid_image twig extensions in store template Tests: * Some tests have been redone. All of them were testing behavior, and because some urls have been changed, for example, these scenarios have been changed. * Added some entries in Visithor and fixed old ones Translations: * Updated the translations guide [EN] * Fixed some keys for purchasable_pack * Added serbian in Languages and fixed Galician
* Using the new repository for purchasable instead of all single ones * Adapted store and templates for this change Fixes: * Class ProductHasOnlyOneCategoryEventListener fixed. Doctrine was crashing because of bad practice of collection setters. More information in doctrine/orm#5601 * Fixtures restarted. No one resultant fixtures cannot be applied when there is some data. Code: * Code has changed in order to establish a new relation between the project and elcodi updates. * All admin pages, twig templates and forms have been created * Store have changed in order to work with new implementation * Some names were explicitely refering to product instead of purchasable. This has changed. * Using purchasable_name and valid_image twig extensions in store template Tests: * Some tests have been redone. All of them were testing behavior, and because some urls have been changed, for example, these scenarios have been changed. * Added some entries in Visithor and fixed old ones Translations: * Updated the translations guide [EN] * Fixed some keys for purchasable_pack * Added serbian in Languages and fixed Galician
* Using the new repository for purchasable instead of all single ones * Adapted store and templates for this change Fixes: * Class ProductHasOnlyOneCategoryEventListener fixed. Doctrine was crashing because of bad practice of collection setters. More information in doctrine/orm#5601 * Fixtures restarted. No one resultant fixtures cannot be applied when there is some data. Code: * Code has changed in order to establish a new relation between the project and elcodi updates. * All admin pages, twig templates and forms have been created * Store have changed in order to work with new implementation * Some names were explicitely refering to product instead of purchasable. This has changed. * Using purchasable_name and valid_image twig extensions in store template Tests: * Some tests have been redone. All of them were testing behavior, and because some urls have been changed, for example, these scenarios have been changed. * Added some entries in Visithor and fixed old ones Translations: * Updated the translations guide [EN] * Fixed some keys for purchasable_pack * Added serbian in Languages and fixed Galician
* Using the new repository for purchasable instead of all single ones * Adapted store and templates for this change Fixes: * Class ProductHasOnlyOneCategoryEventListener fixed. Doctrine was crashing because of bad practice of collection setters. More information in doctrine/orm#5601 * Fixtures restarted. No one resultant fixtures cannot be applied when there is some data. Code: * Code has changed in order to establish a new relation between the project and elcodi updates. * All admin pages, twig templates and forms have been created * Store have changed in order to work with new implementation * Some names were explicitely refering to product instead of purchasable. This has changed. * Using purchasable_name and valid_image twig extensions in store template Tests: * Some tests have been redone. All of them were testing behavior, and because some urls have been changed, for example, these scenarios have been changed. * Testing pack administration * Added some entries in Visithor and fixed old ones Translations: * Updated the translations guide [EN] * Fixed some keys for purchasable_pack * Added serbian in Languages and fixed Galician
* Using the new repository for purchasable instead of all single ones * Adapted store and templates for this change Fixes: * Class ProductHasOnlyOneCategoryEventListener fixed. Doctrine was crashing because of bad practice of collection setters. More information in doctrine/orm#5601 * Fixtures restarted. No one resultant fixtures cannot be applied when there is some data. Code: * Code has changed in order to establish a new relation between the project and elcodi updates. * All admin pages, twig templates and forms have been created * Store have changed in order to work with new implementation * Some names were explicitely refering to product instead of purchasable. This has changed. * Using purchasable_name and valid_image twig extensions in store template Tests: * Some tests have been redone. All of them were testing behavior, and because some urls have been changed, for example, these scenarios have been changed. * Testing pack administration * Added some entries in Visithor and fixed old ones Translations: * Updated the translations guide [EN] * Fixed some keys for purchasable_pack * Added serbian in Languages and fixed Galician
* Using the new repository for purchasable instead of all single ones * Adapted store and templates for this change Fixes: * Class ProductHasOnlyOneCategoryEventListener fixed. Doctrine was crashing because of bad practice of collection setters. More information in doctrine/orm#5601 * Fixtures restarted. No one resultant fixtures cannot be applied when there is some data. Code: * Code has changed in order to establish a new relation between the project and elcodi updates. * All admin pages, twig templates and forms have been created * Store have changed in order to work with new implementation * Some names were explicitely refering to product instead of purchasable. This has changed. * Using purchasable_name and valid_image twig extensions in store template Tests: * Some tests have been redone. All of them were testing behavior, and because some urls have been changed, for example, these scenarios have been changed. * Testing pack administration * Added some entries in Visithor and fixed old ones Translations: * Updated the translations guide [EN] * Fixed some keys for purchasable_pack * Added serbian in Languages and fixed Galician
* Using the new repository for purchasable instead of all single ones * Adapted store and templates for this change Fixes: * Class ProductHasOnlyOneCategoryEventListener fixed. Doctrine was crashing because of bad practice of collection setters. More information in doctrine/orm#5601 * Fixtures restarted. No one resultant fixtures cannot be applied when there is some data. Code: * Code has changed in order to establish a new relation between the project and elcodi updates. * All admin pages, twig templates and forms have been created * Store have changed in order to work with new implementation * Some names were explicitely refering to product instead of purchasable. This has changed. * Using purchasable_name and valid_image twig extensions in store template Tests: * Some tests have been redone. All of them were testing behavior, and because some urls have been changed, for example, these scenarios have been changed. * Testing pack administration * Added some entries in Visithor and fixed old ones Translations: * Updated the translations guide [EN] * Fixed some keys for purchasable_pack * Added serbian in Languages and fixed Galician
* Using the new repository for purchasable instead of all single ones * Adapted store and templates for this change Fixes: * Class ProductHasOnlyOneCategoryEventListener fixed. Doctrine was crashing because of bad practice of collection setters. More information in doctrine/orm#5601 * Fixtures restarted. No one resultant fixtures cannot be applied when there is some data. Code: * Code has changed in order to establish a new relation between the project and elcodi updates. * All admin pages, twig templates and forms have been created * Store have changed in order to work with new implementation * Some names were explicitely refering to product instead of purchasable. This has changed. * Using purchasable_name and valid_image twig extensions in store template Tests: * Some tests have been redone. All of them were testing behavior, and because some urls have been changed, for example, these scenarios have been changed. * Testing pack administration * Added some entries in Visithor and fixed old ones Translations: * Updated the translations guide [EN] * Fixed some keys for purchasable_pack * Added serbian in Languages and fixed Galician
* Using the new repository for purchasable instead of all single ones * Adapted store and templates for this change Fixes: * Class ProductHasOnlyOneCategoryEventListener fixed. Doctrine was crashing because of bad practice of collection setters. More information in doctrine/orm#5601 * Fixtures restarted. No one resultant fixtures cannot be applied when there is some data. Code: * Code has changed in order to establish a new relation between the project and elcodi updates. * All admin pages, twig templates and forms have been created * Store have changed in order to work with new implementation * Some names were explicitely refering to product instead of purchasable. This has changed. * Using purchasable_name and valid_image twig extensions in store template Tests: * Some tests have been redone. All of them were testing behavior, and because some urls have been changed, for example, these scenarios have been changed. * Testing pack administration * Added some entries in Visithor and fixed old ones Translations: * Updated the translations guide [EN] * Fixed some keys for purchasable_pack * Added serbian in Languages and fixed Galician
* Using the new repository for purchasable instead of all single ones * Adapted store and templates for this change Fixes: * Class ProductHasOnlyOneCategoryEventListener fixed. Doctrine was crashing because of bad practice of collection setters. More information in doctrine/orm#5601 * Fixtures restarted. No one resultant fixtures cannot be applied when there is some data. Code: * Code has changed in order to establish a new relation between the project and elcodi updates. * All admin pages, twig templates and forms have been created * Store have changed in order to work with new implementation * Some names were explicitely refering to product instead of purchasable. This has changed. * Using purchasable_name and valid_image twig extensions in store template Tests: * Some tests have been redone. All of them were testing behavior, and because some urls have been changed, for example, these scenarios have been changed. * Testing pack administration * Added some entries in Visithor and fixed old ones Translations: * Updated the translations guide [EN] * Fixed some keys for purchasable_pack * Added serbian in Languages and fixed Galician
* Using the new repository for purchasable instead of all single ones * Adapted store and templates for this change Fixes: * Class ProductHasOnlyOneCategoryEventListener fixed. Doctrine was crashing because of bad practice of collection setters. More information in doctrine/orm#5601 * Fixtures restarted. No one resultant fixtures cannot be applied when there is some data. Code: * Code has changed in order to establish a new relation between the project and elcodi updates. * All admin pages, twig templates and forms have been created * Store have changed in order to work with new implementation * Some names were explicitely refering to product instead of purchasable. This has changed. * Using purchasable_name and valid_image twig extensions in store template Tests: * Some tests have been redone. All of them were testing behavior, and because some urls have been changed, for example, these scenarios have been changed. * Testing pack administration * Added some entries in Visithor and fixed old ones Translations: * Updated the translations guide [EN] * Fixed some keys for purchasable_pack * Added serbian in Languages and fixed Galician
* Using the new repository for purchasable instead of all single ones * Adapted store and templates for this change Fixes: * Class ProductHasOnlyOneCategoryEventListener fixed. Doctrine was crashing because of bad practice of collection setters. More information in doctrine/orm#5601 * Fixtures restarted. No one resultant fixtures cannot be applied when there is some data. Code: * Code has changed in order to establish a new relation between the project and elcodi updates. * All admin pages, twig templates and forms have been created * Store have changed in order to work with new implementation * Some names were explicitely refering to product instead of purchasable. This has changed. * Using purchasable_name and valid_image twig extensions in store template Tests: * Some tests have been redone. All of them were testing behavior, and because some urls have been changed, for example, these scenarios have been changed. * Testing pack administration * Added some entries in Visithor and fixed old ones Translations: * Updated the translations guide [EN] * Fixed some keys for purchasable_pack * Added serbian in Languages and fixed Galician
* Using the new repository for purchasable instead of all single ones * Adapted store and templates for this change Fixes: * Class ProductHasOnlyOneCategoryEventListener fixed. Doctrine was crashing because of bad practice of collection setters. More information in doctrine/orm#5601 * Fixtures restarted. No one resultant fixtures cannot be applied when there is some data. Code: * Code has changed in order to establish a new relation between the project and elcodi updates. * All admin pages, twig templates and forms have been created * Store have changed in order to work with new implementation * Some names were explicitely refering to product instead of purchasable. This has changed. * Using purchasable_name and valid_image twig extensions in store template Tests: * Some tests have been redone. All of them were testing behavior, and because some urls have been changed, for example, these scenarios have been changed. * Testing pack administration * Added some entries in Visithor and fixed old ones Translations: * Updated the translations guide [EN] * Fixed some keys for purchasable_pack * Added serbian in Languages and fixed Galician
* Using the new repository for purchasable instead of all single ones * Adapted store and templates for this change Fixes: * Class ProductHasOnlyOneCategoryEventListener fixed. Doctrine was crashing because of bad practice of collection setters. More information in doctrine/orm#5601 * Fixtures restarted. No one resultant fixtures cannot be applied when there is some data. Code: * Code has changed in order to establish a new relation between the project and elcodi updates. * All admin pages, twig templates and forms have been created * Store have changed in order to work with new implementation * Some names were explicitely refering to product instead of purchasable. This has changed. * Using purchasable_name and valid_image twig extensions in store template Tests: * Some tests have been redone. All of them were testing behavior, and because some urls have been changed, for example, these scenarios have been changed. * Testing pack administration * Added some entries in Visithor and fixed old ones Translations: * Updated the translations guide [EN] * Fixed some keys for purchasable_pack * Added serbian in Languages and fixed Galician
* Using the new repository for purchasable instead of all single ones * Adapted store and templates for this change Fixes: * Class ProductHasOnlyOneCategoryEventListener fixed. Doctrine was crashing because of bad practice of collection setters. More information in doctrine/orm#5601 * Fixtures restarted. No one resultant fixtures cannot be applied when there is some data. Code: * Code has changed in order to establish a new relation between the project and elcodi updates. * All admin pages, twig templates and forms have been created * Store have changed in order to work with new implementation * Some names were explicitely refering to product instead of purchasable. This has changed. * Using purchasable_name and valid_image twig extensions in store template Tests: * Some tests have been redone. All of them were testing behavior, and because some urls have been changed, for example, these scenarios have been changed. * Testing pack administration * Added some entries in Visithor and fixed old ones Translations: * Updated the translations guide [EN] * Fixed some keys for purchasable_pack * Added serbian in Languages and fixed Galician
* Using the new repository for purchasable instead of all single ones * Adapted store and templates for this change Fixes: * Class ProductHasOnlyOneCategoryEventListener fixed. Doctrine was crashing because of bad practice of collection setters. More information in doctrine/orm#5601 * Fixtures restarted. No one resultant fixtures cannot be applied when there is some data. Code: * Code has changed in order to establish a new relation between the project and elcodi updates. * All admin pages, twig templates and forms have been created * Store have changed in order to work with new implementation * Some names were explicitely refering to product instead of purchasable. This has changed. * Using purchasable_name and valid_image twig extensions in store template Tests: * Some tests have been redone. All of them were testing behavior, and because some urls have been changed, for example, these scenarios have been changed. * Testing pack administration * Added some entries in Visithor and fixed old ones Translations: * Updated the translations guide [EN] * Fixed some keys for purchasable_pack * Added serbian in Languages and fixed Galician
* Using the new repository for purchasable instead of all single ones * Adapted store and templates for this change Fixes: * Class ProductHasOnlyOneCategoryEventListener fixed. Doctrine was crashing because of bad practice of collection setters. More information in doctrine/orm#5601 * Fixtures restarted. No one resultant fixtures cannot be applied when there is some data. Code: * Code has changed in order to establish a new relation between the project and elcodi updates. * All admin pages, twig templates and forms have been created * Store have changed in order to work with new implementation * Some names were explicitely refering to product instead of purchasable. This has changed. * Using purchasable_name and valid_image twig extensions in store template Tests: * Some tests have been redone. All of them were testing behavior, and because some urls have been changed, for example, these scenarios have been changed. * Testing pack administration * Added some entries in Visithor and fixed old ones Translations: * Updated the translations guide [EN] * Fixed some keys for purchasable_pack * Added serbian in Languages and fixed Galician
Scenario
The mapping code
We have the Purchasable mapping file (abstract one)
And we have the specific Product mapping file (Extends Purchasable)
The crashing code
This code is part of a service.
productObjectManager
can be considered as the default entity manager. The exception is produced by the second call.Some tips
When I do flush in the first time, the Collection of Category instances is set to dirty. After some investigation, https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/UnitOfWork.php#L607 this line is the one that set this value.
Commenting this line, everything works as expected (I know that that's not an option), but I would like to understand what implies this line and why is there.
Any help please?
Any idea of what could be the issue?
The text was updated successfully, but these errors were encountered: