doctrine / doctrine-laminas-hydrator

Doctrine hydrators for Laminas applications
https://www.doctrine-project.org/projects/doctrine-laminas-hydrator.html
MIT License
33 stars 19 forks source link

Issue with unassigned members / PHP 7.4 (Typed property must not be accessed before initialization) #25

Closed cbichis closed 2 years ago

cbichis commented 3 years ago

Hi,

Under PHP 7.4 there is issue with unassigned members.


File:

    /project/module/.........../IdTrait.php:18

Message:

    Typed property Supplier::$id must not be accessed before initialization

Stack trace:

    #0 /project/vendor/doctrine/doctrine-laminas-hydrator/src/DoctrineObject.php(219):Supplier->getId()
    #1 /project/vendor/doctrine/doctrine-laminas-hydrator/src/DoctrineObject.php(119): Doctrine\Laminas\Hydrator\DoctrineObject->extractByValue()
    #2 /project/vendor/laminas/laminas-form/src/Fieldset.php(659): Doctrine\Laminas\Hydrator\DoctrineObject->extract()
    #3 /project/vendor/laminas/laminas-form/src/Form.php(979): Laminas\Form\Fieldset->extract()
    #4 /project/vendor/laminas/laminas-form/src/Form.php(314): Laminas\Form\Form->extract()
/**
 * @ORM\Id
 * @ORM\GeneratedValue(strategy="IDENTITY")
 * @ORM\Column(name="id", type="integer", nullable=false, options={"unsigned"=true})
 * @Annotation\Exclude()
 */
protected int $id;
driehle commented 3 years ago

This is a duplicate of #15 and was already fixed with #20 and released as 2.1.1. @cbichis Could you please check if upgrading to 2.1.1 solves your issue?

driehle commented 2 years ago

Closing due to inactivity.