-
-
Notifications
You must be signed in to change notification settings - Fork 956
Open
Description
API Platform version(s) affected: 4.2.2 is the latest working patch version without the issue, this issue relates to updating to 4.2.4
Description
When updated to 4.2.4 (4.2.3 had compilation issue) we started seeing failing tests. They seem to relate to patch / update operations on existing Doctrine entities.
Related stack trace:
{
"@context": "\/contexts\/Error",
"@id": "\/errors\/500",
"@type": "Error",
"title": "An error occurred",
"detail": "App\\Domain\\Foo\\Bar::__construct(): Argument #1 ($baz) must be of type App\\Domain\\Bar\\Baz, null given, called in \/app\/vendor\/symfony\/object-mapper\/ObjectMapper.php on line 170",
"status": 500,
"type": "\/errors\/500",
"description": "App\\Domain\\Foo\\Bar::__construct(): Argument #1 ($baz) must be of type App\\Domain\\Bar\\Baz, null given, called in \/app\/vendor\/symfony\/object-mapper\/ObjectMapper.php on line 170",
"trace": [
{
"file": "\/app\/vendor\/symfony\/object-mapper\/ObjectMapper.php",
"line": 170,
"function": "__construct",
"class": "App\\Domain\\Foo\\Bar",
"type": "-\u003E"
},
{
"file": "\/app\/vendor\/symfony\/object-mapper\/ObjectMapper.php",
"line": 54,
"function": "doMap",
"class": "Symfony\\Component\\ObjectMapper\\ObjectMapper",
"type": "-\u003E"
},
{
"file": "\/app\/vendor\/api-platform\/state\/ObjectMapper\/ObjectMapper.php",
"line": 44,
"function": "map",
"class": "Symfony\\Component\\ObjectMapper\\ObjectMapper",
"type": "-\u003E"
},
{
"file": "\/app\/vendor\/api-platform\/state\/Processor\/ObjectMapperProcessor.php",
"line": 67,
"function": "map",
"class": "ApiPlatform\\State\\ObjectMapper\\ObjectMapper",
"type": "-\u003E"
},
{
"file": "\/app\/vendor\/api-platform\/state\/Processor\/WriteProcessor.php",
"line": 58,
"function": "process",
"class": "ApiPlatform\\State\\Processor\\ObjectMapperProcessor",
"type": "-\u003E"
},
{
"file": "\/app\/vendor\/api-platform\/symfony\/Controller\/MainController.php",
"line": 124,
"function": "process",
"class": "ApiPlatform\\State\\Processor\\WriteProcessor",
"type": "-\u003E"
},
{
"file": "\/app\/vendor\/symfony\/http-kernel\/HttpKernel.php",
"line": 183,
"function": "__invoke",
"class": "ApiPlatform\\Symfony\\Controller\\MainController",
"type": "-\u003E"
},
{
"file": "\/app\/vendor\/symfony\/http-kernel\/HttpKernel.php",
"line": 76,
"function": "handleRaw",
"class": "Symfony\\Component\\HttpKernel\\HttpKernel",
"type": "-\u003E"
},
{
"file": "\/app\/vendor\/symfony\/http-kernel\/Kernel.php",
"line": 193,
"function": "handle",
"class": "Symfony\\Component\\HttpKernel\\HttpKernel",
"type": "-\u003E"
},
# ...
]
}
How to reproduce
Possible Solution
Verify whether the object mapper has the right object to patch?
Could this have something to do with the entity from the ReadProvider not being passed along to the ObjectMapperProcessor? And hence leading to the ObjectMapper calling the constructor when creating a new object, while an existing object should be written?
Additional Context
symfony/object-mapper version is 7.4
Metadata
Metadata
Assignees
Labels
No labels