Skip to content

Instantly share code, notes, and snippets.

@brianV
Created August 21, 2020 20:43
Show Gist options
  • Save brianV/c32661186c91b49b013017dde77d5d4a to your computer and use it in GitHub Desktop.
Save brianV/c32661186c91b49b013017dde77d5d4a to your computer and use it in GitHub Desktop.
API Platform: PATH / PUT error when using a OneToOne related to a mapped superclass.
{
"@context": "/api/contexts/Error",
"@type": "hydra:Error",
"hydra:title": "An error occurred",
"hydra:description": "Entity App\\Entity\\Submission@000000002116ebc30000000012ca4827 is not managed. An entity is managed if its fetched from the database or registered as new through EntityManager#persist",
"trace": [
{
"namespace": "",
"short_class": "",
"class": "",
"type": "",
"function": "",
"file": "/var/www/data_warehouse/vendor/doctrine/orm/lib/Doctrine/ORM/ORMInvalidArgumentException.php",
"line": 143,
"args": []
},
{
"namespace": "Doctrine\\ORM",
"short_class": "ORMInvalidArgumentException",
"class": "Doctrine\\ORM\\ORMInvalidArgumentException",
"type": "::",
"function": "entityNotManaged",
"file": "/var/www/data_warehouse/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php",
"line": 2165,
"args": [
[
"object",
"App\\Entity\\Submission"
]
]
},
{
"namespace": "Doctrine\\ORM",
"short_class": "UnitOfWork",
"class": "Doctrine\\ORM\\UnitOfWork",
"type": "->",
"function": "doRefresh",
"file": "/var/www/data_warehouse/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php",
"line": 2139,
"args": [
[
"object",
"App\\Entity\\Submission"
],
[
"array",
{
"000000002116ebc30000000012ca4827": [
"object",
"App\\Entity\\Submission"
]
}
]
]
},
{
"namespace": "Doctrine\\ORM",
"short_class": "UnitOfWork",
"class": "Doctrine\\ORM\\UnitOfWork",
"type": "->",
"function": "refresh",
"file": "/var/www/data_warehouse/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php",
"line": 653,
"args": [
[
"object",
"App\\Entity\\Submission"
]
]
},
{
"namespace": "Doctrine\\ORM",
"short_class": "EntityManager",
"class": "Doctrine\\ORM\\EntityManager",
"type": "->",
"function": "refresh",
"file": "/var/www/data_warehouse/vendor/api-platform/core/src/Bridge/Doctrine/Common/DataPersister.php",
"line": 60,
"args": [
[
"object",
"App\\Entity\\Submission"
]
]
},
{
"namespace": "ApiPlatform\\Core\\Bridge\\Doctrine\\Common",
"short_class": "DataPersister",
"class": "ApiPlatform\\Core\\Bridge\\Doctrine\\Common\\DataPersister",
"type": "->",
"function": "persist",
"file": "/var/www/data_warehouse/vendor/api-platform/core/src/Bridge/Symfony/Bundle/DataPersister/TraceableChainDataPersister.php",
"line": 56,
"args": [
[
"object",
"App\\Entity\\Submission"
],
[
"array",
{
"resource_class": [
"string",
"App\\Entity\\Submission"
],
"item_operation_name": [
"string",
"patch"
],
"receive": [
"boolean",
true
],
"respond": [
"boolean",
true
],
"persist": [
"boolean",
true
]
}
]
]
},
{
"namespace": "ApiPlatform\\Core\\Bridge\\Symfony\\Bundle\\DataPersister",
"short_class": "TraceableChainDataPersister",
"class": "ApiPlatform\\Core\\Bridge\\Symfony\\Bundle\\DataPersister\\TraceableChainDataPersister",
"type": "->",
"function": "persist",
"file": "/var/www/data_warehouse/vendor/api-platform/core/src/EventListener/WriteListener.php",
"line": 76,
"args": [
[
"object",
"App\\Entity\\Submission"
],
[
"array",
{
"resource_class": [
"string",
"App\\Entity\\Submission"
],
"item_operation_name": [
"string",
"patch"
],
"receive": [
"boolean",
true
],
"respond": [
"boolean",
true
],
"persist": [
"boolean",
true
]
}
]
]
},
{
"namespace": "ApiPlatform\\Core\\EventListener",
"short_class": "WriteListener",
"class": "ApiPlatform\\Core\\EventListener\\WriteListener",
"type": "->",
"function": "onKernelView",
"file": "/var/www/data_warehouse/vendor/symfony/event-dispatcher/Debug/WrappedListener.php",
"line": 117,
"args": [
[
"object",
"Symfony\\Component\\HttpKernel\\Event\\ViewEvent"
],
[
"string",
"kernel.view"
],
[
"object",
"Symfony\\Component\\HttpKernel\\Debug\\TraceableEventDispatcher"
]
]
},
{
"namespace": "Symfony\\Component\\EventDispatcher\\Debug",
"short_class": "WrappedListener",
"class": "Symfony\\Component\\EventDispatcher\\Debug\\WrappedListener",
"type": "->",
"function": "__invoke",
"file": "/var/www/data_warehouse/vendor/symfony/event-dispatcher/EventDispatcher.php",
"line": 230,
"args": [
[
"object",
"Symfony\\Component\\HttpKernel\\Event\\ViewEvent"
],
[
"string",
"kernel.view"
],
[
"object",
"Symfony\\Component\\HttpKernel\\Debug\\TraceableEventDispatcher"
]
]
},
{
"namespace": "Symfony\\Component\\EventDispatcher",
"short_class": "EventDispatcher",
"class": "Symfony\\Component\\EventDispatcher\\EventDispatcher",
"type": "->",
"function": "callListeners",
"file": "/var/www/data_warehouse/vendor/symfony/event-dispatcher/EventDispatcher.php",
"line": 59,
"args": [
[
"array",
[
[
"object",
"Symfony\\Component\\EventDispatcher\\Debug\\WrappedListener"
],
[
"object",
"Symfony\\Component\\EventDispatcher\\Debug\\WrappedListener"
],
[
"object",
"Symfony\\Component\\EventDispatcher\\Debug\\WrappedListener"
],
[
"object",
"Symfony\\Component\\EventDispatcher\\Debug\\WrappedListener"
],
[
"object",
"Symfony\\Component\\EventDispatcher\\Debug\\WrappedListener"
]
]
],
[
"string",
"kernel.view"
],
[
"object",
"Symfony\\Component\\HttpKernel\\Event\\ViewEvent"
]
]
},
{
"namespace": "Symfony\\Component\\EventDispatcher",
"short_class": "EventDispatcher",
"class": "Symfony\\Component\\EventDispatcher\\EventDispatcher",
"type": "->",
"function": "dispatch",
"file": "/var/www/data_warehouse/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php",
"line": 151,
"args": [
[
"object",
"Symfony\\Component\\HttpKernel\\Event\\ViewEvent"
],
[
"string",
"kernel.view"
]
]
},
{
"namespace": "Symfony\\Component\\EventDispatcher\\Debug",
"short_class": "TraceableEventDispatcher",
"class": "Symfony\\Component\\EventDispatcher\\Debug\\TraceableEventDispatcher",
"type": "->",
"function": "dispatch",
"file": "/var/www/data_warehouse/vendor/symfony/http-kernel/HttpKernel.php",
"line": 162,
"args": [
[
"object",
"Symfony\\Component\\HttpKernel\\Event\\ViewEvent"
],
[
"string",
"kernel.view"
]
]
},
{
"namespace": "Symfony\\Component\\HttpKernel",
"short_class": "HttpKernel",
"class": "Symfony\\Component\\HttpKernel\\HttpKernel",
"type": "->",
"function": "handleRaw",
"file": "/var/www/data_warehouse/vendor/symfony/http-kernel/HttpKernel.php",
"line": 79,
"args": [
[
"object",
"Symfony\\Component\\HttpFoundation\\Request"
],
[
"integer",
1
]
]
},
{
"namespace": "Symfony\\Component\\HttpKernel",
"short_class": "HttpKernel",
"class": "Symfony\\Component\\HttpKernel\\HttpKernel",
"type": "->",
"function": "handle",
"file": "/var/www/data_warehouse/vendor/symfony/http-kernel/Kernel.php",
"line": 191,
"args": [
[
"object",
"Symfony\\Component\\HttpFoundation\\Request"
],
[
"integer",
1
],
[
"boolean",
true
]
]
},
{
"namespace": "Symfony\\Component\\HttpKernel",
"short_class": "Kernel",
"class": "Symfony\\Component\\HttpKernel\\Kernel",
"type": "->",
"function": "handle",
"file": "/var/www/data_warehouse/public/index.php",
"line": 25,
"args": [
[
"object",
"Symfony\\Component\\HttpFoundation\\Request"
]
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment