You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running a batch update all may throw the following exception:
2019-05-08T18:44:31+00:00 ERR (3): 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@00000000161f4291000000005cd06bdd. 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 /mnt/1TB/html/omeka-s/vendor/doctrine/orm/lib/Doctrine/ORM/ORMInvalidArgumentException.php:92
Stack trace:
#0 /mnt/1TB/html/omeka-s/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php(852): Doctrine\ORM\ORMInvalidArgumentException::newEntityFoundThroughRelationship(Array, Object(Omeka\Entity\Item))
#1 /mnt/1TB/html/omeka-s/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php(740): Doctrine\ORM\UnitOfWork->computeAssociationChanges(Array, Object(Omeka\Entity\Item))
#2 /mnt/1TB/html/omeka-s/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php(802): Doctrine\ORM\UnitOfWork->computeChangeSet(Object(Doctrine\ORM\Mapping\ClassMetadata), Object(Omeka\Entity\Value))
#3 /mnt/1TB/html/omeka-s/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php(340): Doctrine\ORM\UnitOfWork->computeChangeSets()
#4 /mnt/1TB/html/omeka-s/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php(356): Doctrine\ORM\UnitOfWork->commit(NULL)
#5 /mnt/1TB/html/omeka-s/application/src/Api/Adapter/AbstractEntityAdapter.php(406): Doctrine\ORM\EntityManager->flush()
#6 /mnt/1TB/html/omeka-s/application/src/Api/Manager.php(236): Omeka\Api\Adapter\AbstractEntityAdapter->batchUpdate(Object(Omeka\Api\Request))
#7 /mnt/1TB/html/omeka-s/application/src/Api/Manager.php(146): Omeka\Api\Manager->execute(Object(Omeka\Api\Request))
#8 /mnt/1TB/html/omeka-s/application/src/Job/BatchUpdate.php(30): Omeka\Api\Manager->batchUpdate('items', Array, Array, Array)
#9 /mnt/1TB/html/omeka-s/application/src/Job/DispatchStrategy/Synchronous.php(34): Omeka\Job\BatchUpdate->perform()
#10 /mnt/1TB/html/omeka-s/application/src/Job/Dispatcher.php(105): Omeka\Job\DispatchStrategy\Synchronous->send(Object(Omeka\Entity\Job))
#11 /mnt/1TB/html/omeka-s/application/data/scripts/perform-job.php(43): Omeka\Job\Dispatcher->send(Object(Omeka\Entity\Job), Object(Omeka\Job\DispatchStrategy\Synchronous))
#12 {main}
It seems that three conditions must be met to see this bug:
The user clears a property value via the form's "Clear property values" control;
The BatchUpdate job runs batchUpdate() more than once (more than one iteration);
The values to be cleared do not exist (it works if the values exist)
Our use of Doctrine's criteria is likely the cause here. This patch fixes the problem by removing the offending criteria and filtering manually. Prior to this we attempted to detach the Value after it was used and, while that fixed the issue, it replicated resource titles somehow.
This observation may be helpful diagnosing this problem.
I have two items and I set the BatchUpdate job to iterate one item at a time. I add a dcterms:abstract value to item #1 and run "Clear property values" for dcterms:abstract. The job runs successfully, deleting the value. Then I add a dcterms:abstract value to item #2 and run "Clear property values" for dcterms:abstract. The job results in the "A new entity was found" error.
The text was updated successfully, but these errors were encountered:
Instead of detaching the touched entities, keep track of what the
EM was managing before the batch, and detach everything not in that set.
Intended to resolve an issue where Criteria usage causes entities to be
managed by the EM but not connected to the related entity the Criteria
was run against, meaning our usual strategy of relying on "cascade
detach" did not work.
Fix#1415
Running a batch update all may throw the following exception:
It seems that three conditions must be met to see this bug:
BatchUpdate
job runsbatchUpdate()
more than once (more than one iteration);Our use of Doctrine's criteria is likely the cause here. This patch fixes the problem by removing the offending criteria and filtering manually. Prior to this we attempted to detach the
Value
after it was used and, while that fixed the issue, it replicated resource titles somehow.This observation may be helpful diagnosing this problem.
The text was updated successfully, but these errors were encountered: