symfony / symfony

The Symfony PHP framework
https://symfony.com
MIT License
29.8k stars 9.47k forks source link

The property "App\Entity\TypeDictionary::$id" is not readable because it is typed "int". You should initialize it or declare a default value instead. #58884

Open danfoley opened 3 hours ago

danfoley commented 3 hours ago

Symfony version(s) affected

7.1.8

Description

upgrading from 7.0 to 7.1.8 gives me the following error when trying to add items via easy admin:

The property "App\Entity\TypeDictionary::$id" is not readable because it is typed "int". You should initialize it or declare a default value instead.

Symfony\Component\PropertyAccess\Exception\
UninitializedPropertyException
in [vendor/symfony/property-access/PropertyAccessor.php ](file:///usr/www/users/vj/dev.talkinbroadway.com/vendor/symfony/property-access/PropertyAccessor.php#L443)(line 443)
in [vendor/symfony/property-access/PropertyAccessor.php ](file:///usr/www/users/vj/dev.talkinbroadway.com/vendor/symfony/property-access/PropertyAccessor.php#L102)-> readProperty (line 102)
in [vendor/easycorp/easyadmin-bundle/src/Dto/EntityDto.php ](file:///usr/www/users/vj/dev.talkinbroadway.com/vendor/easycorp/easyadmin-bundle/src/Dto/EntityDto.php#L106)-> getValue (line 106)
in [vendor/easycorp/easyadmin-bundle/src/Dto/EntityDto.php ](file:///usr/www/users/vj/dev.talkinbroadway.com/vendor/easycorp/easyadmin-bundle/src/Dto/EntityDto.php#L113)-> getPrimaryKeyValue (line 113)
in [vendor/easycorp/easyadmin-bundle/src/Factory/ActionFactory.php ](file:///usr/www/users/vj/dev.talkinbroadway.com/vendor/easycorp/easyadmin-bundle/src/Factory/ActionFactory.php#L204)-> getPrimaryKeyValueAsString (line 204)
in [vendor/easycorp/easyadmin-bundle/src/Factory/ActionFactory.php ](file:///usr/www/users/vj/dev.talkinbroadway.com/vendor/easycorp/easyadmin-bundle/src/Factory/ActionFactory.php#L146)-> generateActionUrl (line 146)
in [vendor/easycorp/easyadmin-bundle/src/Factory/ActionFactory.php ](file:///usr/www/users/vj/dev.talkinbroadway.com/vendor/easycorp/easyadmin-bundle/src/Factory/ActionFactory.php#L73)-> processAction (line 73)
in [vendor/easycorp/easyadmin-bundle/src/Factory/EntityFactory.php ](file:///usr/www/users/vj/dev.talkinbroadway.com/vendor/easycorp/easyadmin-bundle/src/Factory/EntityFactory.php#L56)-> processEntityActions (line 56)
in [vendor/easycorp/easyadmin-bundle/src/Controller/AbstractCrudController.php ](file:///usr/www/users/vj/dev.talkinbroadway.com/vendor/easycorp/easyadmin-bundle/src/Controller/AbstractCrudController.php#L303)-> processActions (line 303)
in [vendor/symfony/http-kernel/HttpKernel.php ](file:///usr/www/users/vj/dev.talkinbroadway.com/vendor/symfony/http-kernel/HttpKernel.php#L183)-> new (line 183)
in [vendor/symfony/http-kernel/HttpKernel.php ](file:///usr/www/users/vj/dev.talkinbroadway.com/vendor/symfony/http-kernel/HttpKernel.php#L76)-> handleRaw (line 76)
in [vendor/symfony/http-kernel/Kernel.php ](file:///usr/www/users/vj/dev.talkinbroadway.com/vendor/symfony/http-kernel/Kernel.php#L182)-> handle (line 182)
in [vendor/symfony/runtime/Runner/Symfony/HttpKernelRunner.php ](file:///usr/www/users/vj/dev.talkinbroadway.com/vendor/symfony/runtime/Runner/Symfony/HttpKernelRunner.php#L35)-> handle (line 35)
in [vendor/autoload_runtime.php ](file:///usr/www/users/vj/dev.talkinbroadway.com/vendor/autoload_runtime.php#L30)-> run (line 30)
require_once('/usr/www/users/vj/dev.talkinbroadway.com/vendor/autoload_runtime.php')
in [public/index.php ](file:///usr/www/users/vj/dev.talkinbroadway.com/public/index.php#L9)(line 9)
umask(0002);use App\Kernel;require_once dirname(__DIR__) . '/vendor/autoload_runtime.php';return static function (array $context) {    return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);};
Error
Typed property App\Entity\TypeDictionary::$id must not be accessed before initialization

How to reproduce

simply updating the version of symfony from 7.0 to 7.1.8. Downgrading the issue goes away.

Possible Solution

No response

Additional Context

No response

xabbuh commented 2 hours ago

Can you create a small example application that allows to reproduce your issue?