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
I think we're passing the old data and the new data so without any more information, I would think you are passing string instead of object to one of your oTo/oTm/mTo/mTm relations.
i have dumped data of each of the three arrays that are being merged there:
$this->getOriginalEntityData($em, $entity)
$uow->getEntityIdentifier($entity),
$this->getManyToManyRelations($em, $entity)
values from $uow->getEntityIdentifier($entity) override those from $this->getOriginalEntityData($em, $entity), so the resulting array is
in which the 'product' and 'company' entities have been replaced with only their ids
later this causes the 'spl_object_id() expects parameter 1 to be object, string given' TypeError in the LogRevisionsListener::saveRevisionEntityData() function (https://github.com/sonata-project/EntityAuditBundle/blob/1.12.0/src/EventListener/LogRevisionsListener.php#L522) where function \Doctrine\ORM\UnitOfWork::isInIdentityMap($entity) recieves 'PN0002624' in the $entity parameter, instead of the expected Product entity (the same would then happen for the 'PSP' string in place of the expected Company entity)
i think we are saving our entities correctly and this is an oversight in EntityAuditBundle related to primary keys composed of foreign keys (similar to #502)
Environment
Sonata packages
show
Symfony packages
show
PHP version
Subject
Auditing entity which uses foreign key as primary key throws exception when entity manager flushes.
Minimal repository with the bug
Steps to reproduce
When entity manager flushes and exception is thrown: spl_object_id() expects parameter 1 to be object, string given
Table product:
Table product_company
Expected results
Actual results
The text was updated successfully, but these errors were encountered: