dustin10 / VichUploaderBundle

A simple Symfony bundle to ease file uploads with ORM entities and ODM documents.
MIT License
1.84k stars 519 forks source link

getEntityChangeset not working with ODM #1263

Open garak opened 2 years ago

garak commented 2 years ago

Bug Report

Q A
BC Break no
Bundle version 1.19

Summary

Method getEntityChangeset introduced in dbfe95c7cbe04def86b2e64a5c5ff6c9bb9f515d exists only for ORM. For ODM, the method is getDocumentChangeset

Sander-Toonen commented 2 years ago

Is this related to #1277 ?

mcitdev commented 2 years ago

Hi @garak Is there any updates on this?

A quick workaround:

Vich\UploaderBundle\EventListener\Doctrine\CleanListener.php

CleanListener::preUpdate(EventArgs $event) `

  $changeSet = [];

  if($event instanceof \Doctrine\ODM\MongoDB\Event\PreUpdateEventArgs) {

      $changeSet = $event->getDocumentChangeSet();

  }

  elseif ($event instanceof \Doctrine\ORM\Event\PreUpdateEventArgs) {

      $changeSet = $event->getEntityChangeSet();

  }

`

garak commented 2 years ago

@mcitdev unfortunately there's a bigger problem, see #1252 So the idea now is to revert the change made in 1.19 and go back to the same we had in 1.18

mcitdev commented 2 years ago

@garak ok, I see.