Doctrine ORM error on BatchUpdate

Hello,

I’m using Omeka S 3.2.3 (I’m currently unable to upgrade to Omeka 4). I’m writing this message because I’m having a problem making batch changes to specific items.

When I want to make batch modifications (even with a classic BatchUpdate job, I’ve uninstalled BulkEdit), I get the following error:

Doctrine\ORM\ORMInvalidArgumentException: Multiple non-persisted new entities were found through the given association graph:

* A new entity was found through the relationship 'Omeka\Entity\Value#property' that was not configured to cascade persist operations for entity: Omeka\Entity\Property@0000000051849093000000000bfdb22a. 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\Property#__toString()' to get a clue.
* A new entity was found through the relationship 'Omeka\Entity\Value#property' that was not configured to cascade persist operations for entity: DoctrineProxies\__CG__\Omeka\Entity\Property@0000000051848542000000000bfdb22a. 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\Property#__toString()' to get a clue. in /home/omekas/www/vendor/doctrine/orm/lib/Doctrine/ORM/ORMInvalidArgumentException.php:117
Stack trace:
#0 /home/omekas/www/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php(3474): Doctrine\ORM\ORMInvalidArgumentException::newEntitiesFoundThroughRelationships()
#1 /home/omekas/www/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php(385): Doctrine\ORM\UnitOfWork->assertThatThereAreNoUnintentionallyNonPersistedAssociations()
#2 /home/omekas/www/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php(376): Doctrine\ORM\UnitOfWork->commit()
#3 /home/omekas/www/application/src/Api/Adapter/AbstractEntityAdapter.php(487): Doctrine\ORM\EntityManager->flush()
#4 /home/omekas/www/application/src/Api/Manager.php(236): Omeka\Api\Adapter\AbstractEntityAdapter->batchUpdate()
#5 /home/omekas/www/application/src/Api/Manager.php(146): Omeka\Api\Manager->execute()
#6 /home/omekas/www/application/src/Job/BatchUpdate.php(30): Omeka\Api\Manager->batchUpdate()
#7 /home/omekas/www/application/src/Job/DispatchStrategy/Synchronous.php(34): Omeka\Job\BatchUpdate->perform()
#8 /home/omekas/www/modules/Log/src/Job/Dispatcher.php(32): Omeka\Job\DispatchStrategy\Synchronous->send()
#9 /home/omekas/www/application/data/scripts/perform-job.php(66): Log\Job\Dispatcher->send()
#10 {main}

I think this “new entity problem” arose when I created links between my items, using CSVImport to fill the dcterms:hasPart or dcterms:isPartOf fields of my items with omeka Ids.

I’m pretty sure this is the problem, as I can still do BatchUpdate on items that never had these fields.

I’ve tried :

  • Disabling and uninstalling some modules like BulkEdit 3.4.18
  • Remove the dcterms:hasPart and dcterms:isPartOf fields from my records with CSVImport
  • Install the ItemRelations module to configure my item relationships more “cleanly”, though I’m not sure if I succeeded.

I also found this topic but I’m having trouble understanding how to apply the solution. I’m not a developer and don’t know Doctrine ORM very well. Does anyone have any advice for me or has encountered a similar situation more recently?

Many thanks in advance,
Camille

Hello Camille,

These kind of bugs are really hard to track. I would recommend disabling modules one by one until the bug is gone to see which module is causing the error.

If you are using the Search module, try updating it first to the latest version (v0.15.4) as it contains a fix for a similar bug.