Doctrine throws ORMInvalidArgumentException on batch edit items

I get the following error when I try to batch edit (the included one, not the BulkEdit module) items in Omeka-S 3.0.1:

Doctrine\ORM\ORMInvalidArgumentException
A new entity was found through the relationship ‘Omeka\Entity\Value#resource’ that was not configured to cascade persist operations for entity: Omeka\Entity\Item@000000007a7db09d00000000017a7223. 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.

Details:

Doctrine\ORM\ORMInvalidArgumentException: A new entity was found through the relationship 'Omeka\Entity\Value#resource' that was not configured to cascade persist operations for entity: Omeka\Entity\Item@000000007a7db09d00000000017a7223. 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 /data/srv/www/htdocs/omeka-s/vendor/doctrine/orm/lib/Doctrine/ORM/ORMInvalidArgumentException.php:102
Stack trace:
#0 /data/srv/www/htdocs/omeka-s/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php(3460): Doctrine\ORM\ORMInvalidArgumentException::newEntitiesFoundThroughRelationships()
#1 /data/srv/www/htdocs/omeka-s/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php(365): Doctrine\ORM\UnitOfWork->assertThatThereAreNoUnintentionallyNonPersistedAssociations()
#2 /data/srv/www/htdocs/omeka-s/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php(368): Doctrine\ORM\UnitOfWork->commit()
#3 /data/srv/www/htdocs/omeka-s/application/src/Api/Adapter/AbstractEntityAdapter.php(449): Doctrine\ORM\EntityManager->flush()
#4 /data/srv/www/htdocs/omeka-s/application/src/Api/Manager.php(236): Omeka\Api\Adapter\AbstractEntityAdapter->batchUpdate()
#5 /data/srv/www/htdocs/omeka-s/application/src/Api/Manager.php(146): Omeka\Api\Manager->execute()
#6 /data/srv/www/htdocs/omeka-s/application/src/Mvc/Controller/Plugin/Api.php(171): Omeka\Api\Manager->batchUpdate()
#7 /data/srv/www/htdocs/omeka-s/application/src/Controller/Admin/ItemController.php(290): Omeka\Mvc\Controller\Plugin\Api->batchUpdate()
#8 /data/srv/www/htdocs/omeka-s/vendor/laminas/laminas-mvc/src/Controller/AbstractActionController.php(77): Omeka\Controller\Admin\ItemController->batchEditAction()
#9 /data/srv/www/htdocs/omeka-s/vendor/laminas/laminas-eventmanager/src/EventManager.php(321): Laminas\Mvc\Controller\AbstractActionController->onDispatch()
#10 /data/srv/www/htdocs/omeka-s/vendor/laminas/laminas-eventmanager/src/EventManager.php(178): Laminas\EventManager\EventManager->triggerListeners()
#11 /data/srv/www/htdocs/omeka-s/vendor/laminas/laminas-mvc/src/Controller/AbstractController.php(103): Laminas\EventManager\EventManager->triggerEventUntil()
#12 /data/srv/www/htdocs/omeka-s/vendor/laminas/laminas-mvc/src/DispatchListener.php(139): Laminas\Mvc\Controller\AbstractController->dispatch()
#13 /data/srv/www/htdocs/omeka-s/vendor/laminas/laminas-eventmanager/src/EventManager.php(321): Laminas\Mvc\DispatchListener->onDispatch()
#14 /data/srv/www/htdocs/omeka-s/vendor/laminas/laminas-eventmanager/src/EventManager.php(178): Laminas\EventManager\EventManager->triggerListeners()
#15 /data/srv/www/htdocs/omeka-s/vendor/laminas/laminas-mvc/src/Application.php(331): Laminas\EventManager\EventManager->triggerEventUntil()
#16 /data/srv/www/htdocs/omeka-s/index.php(21): Laminas\Mvc\Application->run()
#17 {main}

I’m not sure why you’re having that issue… it may be related to a module you have installed.

Though the error message is different, I believe that a recent fix for a related issue would probably resolve this problem also.

I have now tried out the modules individually. The error does not occur when I deactivate the Bulk Edit and Numeric Data Types modules. As soon as I even activate one of the two, the error occurs again. Just to make it clear, I’m not using a BulkEdit function in my test, but the ‘Clear property values’ function of the integrated batch edit.

The used Versions are:

  • Bulk Edit: 3.3.12.4
  • Numeric Data Types: 1.5.1
  • Omeka-S: 3.0.1

I will now try your suggested fix.

Your posted fix fixed it!

Thanks :grinning:

Okay, that’s good to know, thanks for reporting back on that.