VichUploaderBundle icon indicating copy to clipboard operation
VichUploaderBundle copied to clipboard

Upgrade from 1.18 to 1.19 led to a ORMException error with ID field

Open Hraph opened this issue 2 years ago • 1 comments

BC Break Report

Q A
BC Break yes
Version 1.19.0+
PHP 7.4
Symfony 5.4

Summary

After upgrading to 1.19 (and beyond) I got the following issue:

Entity of type App\Entity\Attachment is missing an assigned ID for field 'id'. 
The identifier generation strategy for this entity requires the ID field to be populated before EntityManager#persist() is called.
If you want automatically generated identifiers instead you need to adjust the metadata mapping accordingly.

The entity has not changed and the GeneratedValue attribute is set:

/**
     * @ORM\Id()
     * @ORM\GeneratedValue()
     * @ORM\Column(type="integer")
     */
    protected ?int $id = null;

Current behavior

My uploading forms are not working anymore. What

Version 1.19 has enabled PHP 8 support. Has something changed with previous implementation?

Hraph avatar Aug 24 '22 18:08 Hraph

It looks like a Doctrine issue. Did you upgrade other than this bundle?

garak avatar Aug 24 '22 20:08 garak