Code Monkey home page Code Monkey logo

Comments (2)

VincentLanglet avatar VincentLanglet commented on June 18, 2024

It seems related to isInIdentityMap, and there is two occurences https://github.com/search?q=repo%3Asonata-project%2FEntityAuditBundle+isInIdentityMap&type=code

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.

from entityauditbundle.

DenyPt96 avatar DenyPt96 commented on June 18, 2024

I suspect that array_merge in the LogRevisionsListener::postUpdate() function (https://github.com/sonata-project/EntityAuditBundle/blob/1.12.0/src/EventListener/LogRevisionsListener.php#L246) provides an unexpected result for those entities which primary keys include a foreign key/relationship to another entity (which is our case with ProductCompany entity)

i have dumped data of each of the three arrays that are being merged there:

$this->getOriginalEntityData($em, $entity)
image

$uow->getEntityIdentifier($entity),
image (1)

$this->getManyToManyRelations($em, $entity)
image (2)

values from $uow->getEntityIdentifier($entity) override those from $this->getOriginalEntityData($em, $entity), so the resulting array is
image (3)

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)

from entityauditbundle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.