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

Fixed doctrine issue when bulk creating resources. #29

Closed

Conversation

Daniel-KM
Copy link

Set persist resource.

@zerocrates
Copy link
Contributor

I assume this is a response to an exception of the "found a new entity" type? Setting cascade for persist on a relationship like this usually isn't the correct solution (even though Doctrine suggests it in the error message). Typically this means that in the "clearing" process of a bulk procedure, the Numeric Data Types entity has been left in the Doctrine entity manager, while its associated Resource has been removed.

I'm surprised this would work at all actually... typically doing this results in Doctrine trying to create a "new" copy of something that already exists and you end up with SQL-level uniqueness constraint failures and things like that. Though with the specific case of Resource being somewhat odd with its inheritance setup it's possible it just happens to not be a problem. I'm not sure.

In what context are you seeing the issue? Presumably a bulk import module of some sort?

@Daniel-KM
Copy link
Author

Yes, the module bulk import allows to specify the data type ; i didn't try with csv import. Yes, it's the same issue in #20 in fact.

Doctrine\ORM\ORMInvalidArgumentException: A new entity was found through the relationship 'NumericDataTypes\Entity\NumericDataTypesTimestamp#resource' that was not configured to cascade persist operations for entity: Omeka\Entity\Item@0000000000a15e11000000006429be68. To solve this issue: Either explicitly call EntityManager#persist() on this unknown entity or configure cascade persist this association in the mapping for example @ManyToOne(..,cascade={"persist"}). If you cannot find out which entity causes the problem implement 'Omeka\Entity\Resource#__toString()' to get a clue. in /var/www/html/OmekaS/vendor/doctrine/orm/lib/Doctrine/ORM/ORMInvalidArgumentException.php:114

And it works with this fix.

@Daniel-KM
Copy link
Author

Probably fixed somewhere else.

@Daniel-KM Daniel-KM closed this Nov 9, 2023
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

Successfully merging this pull request may close these issues.

2 participants