api platform error on post Invalid value provided (invalid IRI?)
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
Working in a vuejs app with axios I have some data structured as follow:
{
...
surgeries: ,//array of object
patientDiseases: [
{
date: a javascrtipt date,
disease: /api/diseases/#id //This is a valid IRI provided by the api in a select
}
] //array of object
}
When I post this data set api-platform's response is Invalid value provided (invalid IRI?)
Here is the stack trace
{
"@context": "/api/contexts/Error",
"@type": "hydra:Error",
"hydra:title": "An error occurred",
"hydra:description": "Invalid value provided (invalid IRI?).",
"trace": [{
"namespace": "",
"short_class": "",
"class": "",
"type": "",
"function": "",
"file": "G:\6.programacion\from git\Veterinaria\vendor\api-platform\core\src\Serializer\AbstractItemNormalizer.php",
"line": 177,
"args":
}, {
"namespace": "ApiPlatform\Core\Serializer",
"short_class": "AbstractItemNormalizer",
"class": "ApiPlatform\Core\Serializer\AbstractItemNormalizer",
"type": "-u003E",
"function": "setAttributeValue",
"file": "G:\6.programacion\from git\Veterinaria\vendor\symfony\serializer\Normalizer\AbstractObjectNormalizer.php",
"line": 261,
"args": [
["object", "App\Entity\Disease"],
["integer", 0],
["string", "/api/diseases/4"],
["string", "json"],
["array", {
"groups": ["array", [
["string", "patient"]
]],
"collection_operation_name": ["string", "post"],
"operation_type": ["string", "collection"],
"api_allow_update": ["boolean", true],
"resource_class": ["string", "App\Entity\PatientDisease"],
"request_uri": ["string", "/api/patients"],
"uri": ["string", "http://localhost:8000/api/patients"],
"api_denormalize": ["boolean", true],
"cache_key": ["string", "e83f0aaf1c78a8d5386bc220724081e1"]
}]
]
}, {
"namespace": "Symfony\Component\Serializer\Normalizer",
"short_class": "AbstractObjectNormalizer",
"class": "Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer",
"type": "-u003E",
"function": "denormalize",
"file": "G:\6.programacion\from git\Veterinaria\vendor\api-platform\core\src\Serializer\AbstractItemNormalizer.php",
"line": 132,
"args": [
["string", "/api/diseases/4"],
["string", "App\Entity\Disease"],
["string", "json"],
["array", {
"groups": ["array", [
["string", "patient"]
]],
"collection_operation_name": ["string", "post"],
"operation_type": ["string", "collection"],
"api_allow_update": ["boolean", true],
"resource_class": ["string", "App\Entity\PatientDisease"],
"request_uri": ["string", "/api/patients"],
"uri": ["string", "http://localhost:8000/api/patients"],
"api_denormalize": ["boolean", true],
"cache_key": ["string", "e83f0aaf1c78a8d5386bc220724081e1"]
}]
]
}, {
"namespace": "ApiPlatform\Core\Serializer",
"short_class": "AbstractItemNormalizer",
"class": "ApiPlatform\Core\Serializer\AbstractItemNormalizer",
"type": "-u003E",
"function": "denormalize",
"file": "G:\6.programacion\from git\Veterinaria\vendor\api-platform\core\src\Serializer\ItemNormalizer.php",
"line": 43,
"args": [
["string", "/api/diseases/4"],
["string", "App\Entity\Disease"],
["string", "json"],
["array", {
"groups": ["array", [
["string", "patient"]
]],
"collection_operation_name": ["string", "post"],
"operation_type": ["string", "collection"],
"api_allow_update": ["boolean", true],
"resource_class": ["string", "App\Entity\PatientDisease"],
"request_uri": ["string", "/api/patients"],
"uri": ["string", "http://localhost:8000/api/patients"],
"api_denormalize": ["boolean", true],
"cache_key": ["string", "e83f0aaf1c78a8d5386bc220724081e1"]
}]
]
}, {
"namespace": "ApiPlatform\Core\Serializer",
"short_class": "ItemNormalizer",
"class": "ApiPlatform\Core\Serializer\ItemNormalizer",
"type": "-u003E",
"function": "denormalize",
"file": "G:\6.programacion\from git\Veterinaria\vendor\symfony\serializer\Serializer.php",
"line": 177,
"args": [
["string", "/api/diseases/4"],
["string", "App\Entity\Disease"],
["string", "json"],
["array", {
"groups": ["array", [
["string", "patient"]
]],
"collection_operation_name": ["string", "post"],
"operation_type": ["string", "collection"],
"api_allow_update": ["boolean", true],
"resource_class": ["string", "App\Entity\PatientDisease"],
"request_uri": ["string", "/api/patients"],
"uri": ["string", "http://localhost:8000/api/patients"],
"api_denormalize": ["boolean", true],
"cache_key": ["string", "e83f0aaf1c78a8d5386bc220724081e1"]
}]
]
}, {
"namespace": "Symfony\Component\Serializer",
"short_class": "Serializer",
"class": "Symfony\Component\Serializer\Serializer",
"type": "-u003E",
"function": "denormalize",
"file": "G:\6.programacion\from git\Veterinaria\vendor\symfony\serializer\Normalizer\AbstractObjectNormalizer.php",
"line": 334,
"args": [
["string", "/api/diseases/4"],
["string", "App\Entity\Disease"],
["string", "json"],
["array", {
"groups": ["array", [
["string", "patient"]
]],
"collection_operation_name": ["string", "post"],
"operation_type": ["string", "collection"],
"api_allow_update": ["boolean", true],
"resource_class": ["string", "App\Entity\PatientDisease"],
"request_uri": ["string", "/api/patients"],
"uri": ["string", "http://localhost:8000/api/patients"],
"api_denormalize": ["boolean", true],
"cache_key": ["string", "e83f0aaf1c78a8d5386bc220724081e1"]
}]
]
}, {
"namespace": "Symfony\Component\Serializer\Normalizer",
"short_class": "AbstractObjectNormalizer",
"class": "Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer",
"type": "-u003E",
"function": "validateAndDenormalize",
"file": "G:\6.programacion\from git\Veterinaria\vendor\symfony\serializer\Normalizer\AbstractObjectNormalizer.php",
"line": 259,
"args": [
["string", "App\Entity\PatientDisease"],
["string", "disease"],
["string", "/api/diseases/4"],
["string", "json"],
["array", {
"groups": ["array", [
["string", "patient"]
]],
"collection_operation_name": ["string", "post"],
"operation_type": ["string", "collection"],
"api_allow_update": ["boolean", true],
"resource_class": ["string", "App\Entity\PatientDisease"],
"request_uri": ["string", "/api/patients"],
"uri": ["string", "http://localhost:8000/api/patients"],
"api_denormalize": ["boolean", true],
"cache_key": ["string", "e83f0aaf1c78a8d5386bc220724081e1"]
}]
]
}, {
"namespace": "Symfony\Component\Serializer\Normalizer",
"short_class": "AbstractObjectNormalizer",
"class": "Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer",
"type": "-u003E",
"function": "denormalize",
"file": "G:\6.programacion\from git\Veterinaria\vendor\symfony\serializer\Serializer.php",
"line": 177,
"args": [
["array", {
"patient": ["array", ],
"date": ["string", "2018-11-27T13:03:00.000Z"],
"disease": ["string", "/api/diseases/4"]
}],
["string", "App\Entity\PatientDisease"],
["string", "json"],
["array", {
"groups": ["array", [
["string", "patient"]
]],
"collection_operation_name": ["string", "post"],
"operation_type": ["string", "collection"],
"api_allow_update": ["boolean", true],
"resource_class": ["string", "App\Entity\PatientDisease"],
"request_uri": ["string", "/api/patients"],
"uri": ["string", "http://localhost:8000/api/patients"],
"api_denormalize": ["boolean", true],
"cache_key": ["string", "e83f0aaf1c78a8d5386bc220724081e1"]
}]
]
}, {
"namespace": "Symfony\Component\Serializer",
"short_class": "Serializer",
"class": "Symfony\Component\Serializer\Serializer",
"type": "-u003E",
"function": "denormalize",
"file": "G:\6.programacion\from git\Veterinaria\vendor\api-platform\core\src\Serializer\AbstractItemNormalizer.php",
"line": 307,
"args": [
["array", {
"patient": ["array", ],
"date": ["string", "2018-11-27T13:03:00.000Z"],
"disease": ["string", "/api/diseases/4"]
}],
["string", "App\Entity\PatientDisease"],
["string", "json"],
["array", {
"groups": ["array", [
["string", "patient"]
]],
"collection_operation_name": ["string", "post"],
"operation_type": ["string", "collection"],
"api_allow_update": ["boolean", true],
"resource_class": ["string", "App\Entity\PatientDisease"],
"request_uri": ["string", "/api/patients"],
"uri": ["string", "http://localhost:8000/api/patients"],
"api_denormalize": ["boolean", true],
"cache_key": ["string", "e83f0aaf1c78a8d5386bc220724081e1"]
}]
]
}, {
"namespace": "ApiPlatform\Core\Serializer",
"short_class": "AbstractItemNormalizer",
"class": "ApiPlatform\Core\Serializer\AbstractItemNormalizer",
"type": "-u003E",
"function": "denormalizeRelation",
"file": "G:\6.programacion\from git\Veterinaria\vendor\api-platform\core\src\Serializer\AbstractItemNormalizer.php",
"line": 272,
"args": [
["string", "patientDiseases"],
["object", "ApiPlatform\Core\Metadata\Property\PropertyMetadata"],
["string", "App\Entity\PatientDisease"],
["array", {
"patient": ["array", ],
"date": ["string", "2018-11-27T13:03:00.000Z"],
"disease": ["string", "/api/diseases/4"]
}],
["string", "json"],
["array", {
"groups": ["array", [
["string", "patient"]
]],
"collection_operation_name": ["string", "post"],
"operation_type": ["string", "collection"],
"api_allow_update": ["boolean", true],
"resource_class": ["string", "App\Entity\PatientDisease"],
"request_uri": ["string", "/api/patients"],
"uri": ["string", "http://localhost:8000/api/patients"],
"api_denormalize": ["boolean", true],
"cache_key": ["string", "e83f0aaf1c78a8d5386bc220724081e1"]
}]
]
}, {
"namespace": "ApiPlatform\Core\Serializer",
"short_class": "AbstractItemNormalizer",
"class": "ApiPlatform\Core\Serializer\AbstractItemNormalizer",
"type": "-u003E",
"function": "denormalizeCollection",
"file": "G:\6.programacion\from git\Veterinaria\vendor\api-platform\core\src\Serializer\AbstractItemNormalizer.php",
"line": 204,
"args": [
["string", "patientDiseases"],
["object", "ApiPlatform\Core\Metadata\Property\PropertyMetadata"],
["object", "Symfony\Component\PropertyInfo\Type"],
["string", "App\Entity\PatientDisease"],
["array", [
["array", {
"patient": ["array", ],
"date": ["string", "2018-11-27T13:03:00.000Z"],
"disease": ["string", "/api/diseases/4"]
}]
]],
["string", "json"],
["array", {
"groups": ["array", [
["string", "patient"]
]],
"collection_operation_name": ["string", "post"],
"operation_type": ["string", "collection"],
"api_allow_update": ["boolean", false],
"resource_class": ["string", "App\Entity\Patient"],
"request_uri": ["string", "/api/patients"],
"uri": ["string", "http://localhost:8000/api/patients"],
"api_denormalize": ["boolean", true],
"cache_key": ["string", "e83f0aaf1c78a8d5386bc220724081e1"]
}]
]
}, {
"namespace": "ApiPlatform\Core\Serializer",
"short_class": "AbstractItemNormalizer",
"class": "ApiPlatform\Core\Serializer\AbstractItemNormalizer",
"type": "-u003E",
"function": "setAttributeValue",
"file": "G:\6.programacion\from git\Veterinaria\vendor\symfony\serializer\Normalizer\AbstractObjectNormalizer.php",
"line": 261,
"args": [
["object", "App\Entity\Patient"],
["string", "patientDiseases"],
["array", [
["array", {
"patient": ["array", ],
"date": ["string", "2018-11-27T13:03:00.000Z"],
"disease": ["string", "/api/diseases/4"]
}]
]],
["string", "json"],
["array", {
"groups": ["array", [
["string", "patient"]
]],
"collection_operation_name": ["string", "post"],
"operation_type": ["string", "collection"],
"api_allow_update": ["boolean", false],
"resource_class": ["string", "App\Entity\Patient"],
"request_uri": ["string", "/api/patients"],
"uri": ["string", "http://localhost:8000/api/patients"],
"api_denormalize": ["boolean", true],
"cache_key": ["string", "e83f0aaf1c78a8d5386bc220724081e1"]
}]
]
}, {
"namespace": "Symfony\Component\Serializer\Normalizer",
"short_class": "AbstractObjectNormalizer",
"class": "Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer",
"type": "-u003E",
"function": "denormalize",
"file": "G:\6.programacion\from git\Veterinaria\vendor\api-platform\core\src\Serializer\AbstractItemNormalizer.php",
"line": 132,
"args": [
["array", {
"name": ["string", "perro"],
"age": ["integer", 8],
"specie": ["string", "/api/species/1"],
"breed": ["string", "/api/breeds/1"],
"birthdate": ["string", "2018-11-07T13:03:00.000Z"],
"entrydate": ["string", "2018-11-23T13:03:03.182Z"],
"gender": ["string", "/api/genders/1"],
"temperament": ["string", "/api/temperaments/1"],
"chip": ["string", "asdasd2asd"],
"coatType": ["string", "/api/coat_types/1"],
"coatColor": ["string", "/api/coat_colors/1"],
"details": ["string", "m.cxvczxjkcxzvjklczv"],
"status": ["string", "/api/status_patients/1"],
"client": ["array", {
"name": ["string", "Juan"],
"lastName": ["string", "Alberto"],
"secondSurname": ["string", "Asdasd"],
"email": ["string", "asdasd@asdasd.as"],
"phone1": ["string", "234234"],
"phone2": ["string", "24234"],
"clientType": ["string", "/api/client_types/1"],
"sector": ["string", "/api/sectors/1"],
"identificationCard": ["string", "98989898989"],
"address": ["string", "sdfsdfsdfs sdf sd5f sd"]
}],
"isActive": ["boolean", true],
"surgeries": ["array", [
["array", {
"name": ["string", "sdfa fsdf"],
"date": ["string", "2018-11-30T13:03:00.000Z"],
"patient": ["array", ]
}],
["array", {
"name": ["string", "sdfa fsdf"],
"date": ["string", "2018-11-30T13:03:00.000Z"],
"patient": ["array", ]
}],
["array", {
"name": ["string", "sdfa fsdf"],
"date": ["string", "2018-11-30T13:03:00.000Z"],
"patient": ["array", ]
}],
["array", {
"name": ["string", "sdfa fsdf"],
"date": ["string", "2018-11-30T13:03:00.000Z"],
"patient": ["array", ]
}]
]],
"patientDiseases": ["array", [
["array", {
"patient": ["array", ],
"date": ["string", "2018-11-27T13:03:00.000Z"],
"disease": ["string", "/api/diseases/4"]
}]
]]
}],
["string", "App\Entity\Patient"],
["string", "json"],
As you can see the IRI is present in the request in every object of the array but api-platform still raising an error of Invalid IRI.
The entities are configured with cascade persist option
Do you have any advice on how could I resolve this situation?
Thanks in advance
symfony symfony4 bad-request api-platform.com iri
add a comment |
Working in a vuejs app with axios I have some data structured as follow:
{
...
surgeries: ,//array of object
patientDiseases: [
{
date: a javascrtipt date,
disease: /api/diseases/#id //This is a valid IRI provided by the api in a select
}
] //array of object
}
When I post this data set api-platform's response is Invalid value provided (invalid IRI?)
Here is the stack trace
{
"@context": "/api/contexts/Error",
"@type": "hydra:Error",
"hydra:title": "An error occurred",
"hydra:description": "Invalid value provided (invalid IRI?).",
"trace": [{
"namespace": "",
"short_class": "",
"class": "",
"type": "",
"function": "",
"file": "G:\6.programacion\from git\Veterinaria\vendor\api-platform\core\src\Serializer\AbstractItemNormalizer.php",
"line": 177,
"args":
}, {
"namespace": "ApiPlatform\Core\Serializer",
"short_class": "AbstractItemNormalizer",
"class": "ApiPlatform\Core\Serializer\AbstractItemNormalizer",
"type": "-u003E",
"function": "setAttributeValue",
"file": "G:\6.programacion\from git\Veterinaria\vendor\symfony\serializer\Normalizer\AbstractObjectNormalizer.php",
"line": 261,
"args": [
["object", "App\Entity\Disease"],
["integer", 0],
["string", "/api/diseases/4"],
["string", "json"],
["array", {
"groups": ["array", [
["string", "patient"]
]],
"collection_operation_name": ["string", "post"],
"operation_type": ["string", "collection"],
"api_allow_update": ["boolean", true],
"resource_class": ["string", "App\Entity\PatientDisease"],
"request_uri": ["string", "/api/patients"],
"uri": ["string", "http://localhost:8000/api/patients"],
"api_denormalize": ["boolean", true],
"cache_key": ["string", "e83f0aaf1c78a8d5386bc220724081e1"]
}]
]
}, {
"namespace": "Symfony\Component\Serializer\Normalizer",
"short_class": "AbstractObjectNormalizer",
"class": "Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer",
"type": "-u003E",
"function": "denormalize",
"file": "G:\6.programacion\from git\Veterinaria\vendor\api-platform\core\src\Serializer\AbstractItemNormalizer.php",
"line": 132,
"args": [
["string", "/api/diseases/4"],
["string", "App\Entity\Disease"],
["string", "json"],
["array", {
"groups": ["array", [
["string", "patient"]
]],
"collection_operation_name": ["string", "post"],
"operation_type": ["string", "collection"],
"api_allow_update": ["boolean", true],
"resource_class": ["string", "App\Entity\PatientDisease"],
"request_uri": ["string", "/api/patients"],
"uri": ["string", "http://localhost:8000/api/patients"],
"api_denormalize": ["boolean", true],
"cache_key": ["string", "e83f0aaf1c78a8d5386bc220724081e1"]
}]
]
}, {
"namespace": "ApiPlatform\Core\Serializer",
"short_class": "AbstractItemNormalizer",
"class": "ApiPlatform\Core\Serializer\AbstractItemNormalizer",
"type": "-u003E",
"function": "denormalize",
"file": "G:\6.programacion\from git\Veterinaria\vendor\api-platform\core\src\Serializer\ItemNormalizer.php",
"line": 43,
"args": [
["string", "/api/diseases/4"],
["string", "App\Entity\Disease"],
["string", "json"],
["array", {
"groups": ["array", [
["string", "patient"]
]],
"collection_operation_name": ["string", "post"],
"operation_type": ["string", "collection"],
"api_allow_update": ["boolean", true],
"resource_class": ["string", "App\Entity\PatientDisease"],
"request_uri": ["string", "/api/patients"],
"uri": ["string", "http://localhost:8000/api/patients"],
"api_denormalize": ["boolean", true],
"cache_key": ["string", "e83f0aaf1c78a8d5386bc220724081e1"]
}]
]
}, {
"namespace": "ApiPlatform\Core\Serializer",
"short_class": "ItemNormalizer",
"class": "ApiPlatform\Core\Serializer\ItemNormalizer",
"type": "-u003E",
"function": "denormalize",
"file": "G:\6.programacion\from git\Veterinaria\vendor\symfony\serializer\Serializer.php",
"line": 177,
"args": [
["string", "/api/diseases/4"],
["string", "App\Entity\Disease"],
["string", "json"],
["array", {
"groups": ["array", [
["string", "patient"]
]],
"collection_operation_name": ["string", "post"],
"operation_type": ["string", "collection"],
"api_allow_update": ["boolean", true],
"resource_class": ["string", "App\Entity\PatientDisease"],
"request_uri": ["string", "/api/patients"],
"uri": ["string", "http://localhost:8000/api/patients"],
"api_denormalize": ["boolean", true],
"cache_key": ["string", "e83f0aaf1c78a8d5386bc220724081e1"]
}]
]
}, {
"namespace": "Symfony\Component\Serializer",
"short_class": "Serializer",
"class": "Symfony\Component\Serializer\Serializer",
"type": "-u003E",
"function": "denormalize",
"file": "G:\6.programacion\from git\Veterinaria\vendor\symfony\serializer\Normalizer\AbstractObjectNormalizer.php",
"line": 334,
"args": [
["string", "/api/diseases/4"],
["string", "App\Entity\Disease"],
["string", "json"],
["array", {
"groups": ["array", [
["string", "patient"]
]],
"collection_operation_name": ["string", "post"],
"operation_type": ["string", "collection"],
"api_allow_update": ["boolean", true],
"resource_class": ["string", "App\Entity\PatientDisease"],
"request_uri": ["string", "/api/patients"],
"uri": ["string", "http://localhost:8000/api/patients"],
"api_denormalize": ["boolean", true],
"cache_key": ["string", "e83f0aaf1c78a8d5386bc220724081e1"]
}]
]
}, {
"namespace": "Symfony\Component\Serializer\Normalizer",
"short_class": "AbstractObjectNormalizer",
"class": "Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer",
"type": "-u003E",
"function": "validateAndDenormalize",
"file": "G:\6.programacion\from git\Veterinaria\vendor\symfony\serializer\Normalizer\AbstractObjectNormalizer.php",
"line": 259,
"args": [
["string", "App\Entity\PatientDisease"],
["string", "disease"],
["string", "/api/diseases/4"],
["string", "json"],
["array", {
"groups": ["array", [
["string", "patient"]
]],
"collection_operation_name": ["string", "post"],
"operation_type": ["string", "collection"],
"api_allow_update": ["boolean", true],
"resource_class": ["string", "App\Entity\PatientDisease"],
"request_uri": ["string", "/api/patients"],
"uri": ["string", "http://localhost:8000/api/patients"],
"api_denormalize": ["boolean", true],
"cache_key": ["string", "e83f0aaf1c78a8d5386bc220724081e1"]
}]
]
}, {
"namespace": "Symfony\Component\Serializer\Normalizer",
"short_class": "AbstractObjectNormalizer",
"class": "Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer",
"type": "-u003E",
"function": "denormalize",
"file": "G:\6.programacion\from git\Veterinaria\vendor\symfony\serializer\Serializer.php",
"line": 177,
"args": [
["array", {
"patient": ["array", ],
"date": ["string", "2018-11-27T13:03:00.000Z"],
"disease": ["string", "/api/diseases/4"]
}],
["string", "App\Entity\PatientDisease"],
["string", "json"],
["array", {
"groups": ["array", [
["string", "patient"]
]],
"collection_operation_name": ["string", "post"],
"operation_type": ["string", "collection"],
"api_allow_update": ["boolean", true],
"resource_class": ["string", "App\Entity\PatientDisease"],
"request_uri": ["string", "/api/patients"],
"uri": ["string", "http://localhost:8000/api/patients"],
"api_denormalize": ["boolean", true],
"cache_key": ["string", "e83f0aaf1c78a8d5386bc220724081e1"]
}]
]
}, {
"namespace": "Symfony\Component\Serializer",
"short_class": "Serializer",
"class": "Symfony\Component\Serializer\Serializer",
"type": "-u003E",
"function": "denormalize",
"file": "G:\6.programacion\from git\Veterinaria\vendor\api-platform\core\src\Serializer\AbstractItemNormalizer.php",
"line": 307,
"args": [
["array", {
"patient": ["array", ],
"date": ["string", "2018-11-27T13:03:00.000Z"],
"disease": ["string", "/api/diseases/4"]
}],
["string", "App\Entity\PatientDisease"],
["string", "json"],
["array", {
"groups": ["array", [
["string", "patient"]
]],
"collection_operation_name": ["string", "post"],
"operation_type": ["string", "collection"],
"api_allow_update": ["boolean", true],
"resource_class": ["string", "App\Entity\PatientDisease"],
"request_uri": ["string", "/api/patients"],
"uri": ["string", "http://localhost:8000/api/patients"],
"api_denormalize": ["boolean", true],
"cache_key": ["string", "e83f0aaf1c78a8d5386bc220724081e1"]
}]
]
}, {
"namespace": "ApiPlatform\Core\Serializer",
"short_class": "AbstractItemNormalizer",
"class": "ApiPlatform\Core\Serializer\AbstractItemNormalizer",
"type": "-u003E",
"function": "denormalizeRelation",
"file": "G:\6.programacion\from git\Veterinaria\vendor\api-platform\core\src\Serializer\AbstractItemNormalizer.php",
"line": 272,
"args": [
["string", "patientDiseases"],
["object", "ApiPlatform\Core\Metadata\Property\PropertyMetadata"],
["string", "App\Entity\PatientDisease"],
["array", {
"patient": ["array", ],
"date": ["string", "2018-11-27T13:03:00.000Z"],
"disease": ["string", "/api/diseases/4"]
}],
["string", "json"],
["array", {
"groups": ["array", [
["string", "patient"]
]],
"collection_operation_name": ["string", "post"],
"operation_type": ["string", "collection"],
"api_allow_update": ["boolean", true],
"resource_class": ["string", "App\Entity\PatientDisease"],
"request_uri": ["string", "/api/patients"],
"uri": ["string", "http://localhost:8000/api/patients"],
"api_denormalize": ["boolean", true],
"cache_key": ["string", "e83f0aaf1c78a8d5386bc220724081e1"]
}]
]
}, {
"namespace": "ApiPlatform\Core\Serializer",
"short_class": "AbstractItemNormalizer",
"class": "ApiPlatform\Core\Serializer\AbstractItemNormalizer",
"type": "-u003E",
"function": "denormalizeCollection",
"file": "G:\6.programacion\from git\Veterinaria\vendor\api-platform\core\src\Serializer\AbstractItemNormalizer.php",
"line": 204,
"args": [
["string", "patientDiseases"],
["object", "ApiPlatform\Core\Metadata\Property\PropertyMetadata"],
["object", "Symfony\Component\PropertyInfo\Type"],
["string", "App\Entity\PatientDisease"],
["array", [
["array", {
"patient": ["array", ],
"date": ["string", "2018-11-27T13:03:00.000Z"],
"disease": ["string", "/api/diseases/4"]
}]
]],
["string", "json"],
["array", {
"groups": ["array", [
["string", "patient"]
]],
"collection_operation_name": ["string", "post"],
"operation_type": ["string", "collection"],
"api_allow_update": ["boolean", false],
"resource_class": ["string", "App\Entity\Patient"],
"request_uri": ["string", "/api/patients"],
"uri": ["string", "http://localhost:8000/api/patients"],
"api_denormalize": ["boolean", true],
"cache_key": ["string", "e83f0aaf1c78a8d5386bc220724081e1"]
}]
]
}, {
"namespace": "ApiPlatform\Core\Serializer",
"short_class": "AbstractItemNormalizer",
"class": "ApiPlatform\Core\Serializer\AbstractItemNormalizer",
"type": "-u003E",
"function": "setAttributeValue",
"file": "G:\6.programacion\from git\Veterinaria\vendor\symfony\serializer\Normalizer\AbstractObjectNormalizer.php",
"line": 261,
"args": [
["object", "App\Entity\Patient"],
["string", "patientDiseases"],
["array", [
["array", {
"patient": ["array", ],
"date": ["string", "2018-11-27T13:03:00.000Z"],
"disease": ["string", "/api/diseases/4"]
}]
]],
["string", "json"],
["array", {
"groups": ["array", [
["string", "patient"]
]],
"collection_operation_name": ["string", "post"],
"operation_type": ["string", "collection"],
"api_allow_update": ["boolean", false],
"resource_class": ["string", "App\Entity\Patient"],
"request_uri": ["string", "/api/patients"],
"uri": ["string", "http://localhost:8000/api/patients"],
"api_denormalize": ["boolean", true],
"cache_key": ["string", "e83f0aaf1c78a8d5386bc220724081e1"]
}]
]
}, {
"namespace": "Symfony\Component\Serializer\Normalizer",
"short_class": "AbstractObjectNormalizer",
"class": "Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer",
"type": "-u003E",
"function": "denormalize",
"file": "G:\6.programacion\from git\Veterinaria\vendor\api-platform\core\src\Serializer\AbstractItemNormalizer.php",
"line": 132,
"args": [
["array", {
"name": ["string", "perro"],
"age": ["integer", 8],
"specie": ["string", "/api/species/1"],
"breed": ["string", "/api/breeds/1"],
"birthdate": ["string", "2018-11-07T13:03:00.000Z"],
"entrydate": ["string", "2018-11-23T13:03:03.182Z"],
"gender": ["string", "/api/genders/1"],
"temperament": ["string", "/api/temperaments/1"],
"chip": ["string", "asdasd2asd"],
"coatType": ["string", "/api/coat_types/1"],
"coatColor": ["string", "/api/coat_colors/1"],
"details": ["string", "m.cxvczxjkcxzvjklczv"],
"status": ["string", "/api/status_patients/1"],
"client": ["array", {
"name": ["string", "Juan"],
"lastName": ["string", "Alberto"],
"secondSurname": ["string", "Asdasd"],
"email": ["string", "asdasd@asdasd.as"],
"phone1": ["string", "234234"],
"phone2": ["string", "24234"],
"clientType": ["string", "/api/client_types/1"],
"sector": ["string", "/api/sectors/1"],
"identificationCard": ["string", "98989898989"],
"address": ["string", "sdfsdfsdfs sdf sd5f sd"]
}],
"isActive": ["boolean", true],
"surgeries": ["array", [
["array", {
"name": ["string", "sdfa fsdf"],
"date": ["string", "2018-11-30T13:03:00.000Z"],
"patient": ["array", ]
}],
["array", {
"name": ["string", "sdfa fsdf"],
"date": ["string", "2018-11-30T13:03:00.000Z"],
"patient": ["array", ]
}],
["array", {
"name": ["string", "sdfa fsdf"],
"date": ["string", "2018-11-30T13:03:00.000Z"],
"patient": ["array", ]
}],
["array", {
"name": ["string", "sdfa fsdf"],
"date": ["string", "2018-11-30T13:03:00.000Z"],
"patient": ["array", ]
}]
]],
"patientDiseases": ["array", [
["array", {
"patient": ["array", ],
"date": ["string", "2018-11-27T13:03:00.000Z"],
"disease": ["string", "/api/diseases/4"]
}]
]]
}],
["string", "App\Entity\Patient"],
["string", "json"],
As you can see the IRI is present in the request in every object of the array but api-platform still raising an error of Invalid IRI.
The entities are configured with cascade persist option
Do you have any advice on how could I resolve this situation?
Thanks in advance
symfony symfony4 bad-request api-platform.com iri
add a comment |
Working in a vuejs app with axios I have some data structured as follow:
{
...
surgeries: ,//array of object
patientDiseases: [
{
date: a javascrtipt date,
disease: /api/diseases/#id //This is a valid IRI provided by the api in a select
}
] //array of object
}
When I post this data set api-platform's response is Invalid value provided (invalid IRI?)
Here is the stack trace
{
"@context": "/api/contexts/Error",
"@type": "hydra:Error",
"hydra:title": "An error occurred",
"hydra:description": "Invalid value provided (invalid IRI?).",
"trace": [{
"namespace": "",
"short_class": "",
"class": "",
"type": "",
"function": "",
"file": "G:\6.programacion\from git\Veterinaria\vendor\api-platform\core\src\Serializer\AbstractItemNormalizer.php",
"line": 177,
"args":
}, {
"namespace": "ApiPlatform\Core\Serializer",
"short_class": "AbstractItemNormalizer",
"class": "ApiPlatform\Core\Serializer\AbstractItemNormalizer",
"type": "-u003E",
"function": "setAttributeValue",
"file": "G:\6.programacion\from git\Veterinaria\vendor\symfony\serializer\Normalizer\AbstractObjectNormalizer.php",
"line": 261,
"args": [
["object", "App\Entity\Disease"],
["integer", 0],
["string", "/api/diseases/4"],
["string", "json"],
["array", {
"groups": ["array", [
["string", "patient"]
]],
"collection_operation_name": ["string", "post"],
"operation_type": ["string", "collection"],
"api_allow_update": ["boolean", true],
"resource_class": ["string", "App\Entity\PatientDisease"],
"request_uri": ["string", "/api/patients"],
"uri": ["string", "http://localhost:8000/api/patients"],
"api_denormalize": ["boolean", true],
"cache_key": ["string", "e83f0aaf1c78a8d5386bc220724081e1"]
}]
]
}, {
"namespace": "Symfony\Component\Serializer\Normalizer",
"short_class": "AbstractObjectNormalizer",
"class": "Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer",
"type": "-u003E",
"function": "denormalize",
"file": "G:\6.programacion\from git\Veterinaria\vendor\api-platform\core\src\Serializer\AbstractItemNormalizer.php",
"line": 132,
"args": [
["string", "/api/diseases/4"],
["string", "App\Entity\Disease"],
["string", "json"],
["array", {
"groups": ["array", [
["string", "patient"]
]],
"collection_operation_name": ["string", "post"],
"operation_type": ["string", "collection"],
"api_allow_update": ["boolean", true],
"resource_class": ["string", "App\Entity\PatientDisease"],
"request_uri": ["string", "/api/patients"],
"uri": ["string", "http://localhost:8000/api/patients"],
"api_denormalize": ["boolean", true],
"cache_key": ["string", "e83f0aaf1c78a8d5386bc220724081e1"]
}]
]
}, {
"namespace": "ApiPlatform\Core\Serializer",
"short_class": "AbstractItemNormalizer",
"class": "ApiPlatform\Core\Serializer\AbstractItemNormalizer",
"type": "-u003E",
"function": "denormalize",
"file": "G:\6.programacion\from git\Veterinaria\vendor\api-platform\core\src\Serializer\ItemNormalizer.php",
"line": 43,
"args": [
["string", "/api/diseases/4"],
["string", "App\Entity\Disease"],
["string", "json"],
["array", {
"groups": ["array", [
["string", "patient"]
]],
"collection_operation_name": ["string", "post"],
"operation_type": ["string", "collection"],
"api_allow_update": ["boolean", true],
"resource_class": ["string", "App\Entity\PatientDisease"],
"request_uri": ["string", "/api/patients"],
"uri": ["string", "http://localhost:8000/api/patients"],
"api_denormalize": ["boolean", true],
"cache_key": ["string", "e83f0aaf1c78a8d5386bc220724081e1"]
}]
]
}, {
"namespace": "ApiPlatform\Core\Serializer",
"short_class": "ItemNormalizer",
"class": "ApiPlatform\Core\Serializer\ItemNormalizer",
"type": "-u003E",
"function": "denormalize",
"file": "G:\6.programacion\from git\Veterinaria\vendor\symfony\serializer\Serializer.php",
"line": 177,
"args": [
["string", "/api/diseases/4"],
["string", "App\Entity\Disease"],
["string", "json"],
["array", {
"groups": ["array", [
["string", "patient"]
]],
"collection_operation_name": ["string", "post"],
"operation_type": ["string", "collection"],
"api_allow_update": ["boolean", true],
"resource_class": ["string", "App\Entity\PatientDisease"],
"request_uri": ["string", "/api/patients"],
"uri": ["string", "http://localhost:8000/api/patients"],
"api_denormalize": ["boolean", true],
"cache_key": ["string", "e83f0aaf1c78a8d5386bc220724081e1"]
}]
]
}, {
"namespace": "Symfony\Component\Serializer",
"short_class": "Serializer",
"class": "Symfony\Component\Serializer\Serializer",
"type": "-u003E",
"function": "denormalize",
"file": "G:\6.programacion\from git\Veterinaria\vendor\symfony\serializer\Normalizer\AbstractObjectNormalizer.php",
"line": 334,
"args": [
["string", "/api/diseases/4"],
["string", "App\Entity\Disease"],
["string", "json"],
["array", {
"groups": ["array", [
["string", "patient"]
]],
"collection_operation_name": ["string", "post"],
"operation_type": ["string", "collection"],
"api_allow_update": ["boolean", true],
"resource_class": ["string", "App\Entity\PatientDisease"],
"request_uri": ["string", "/api/patients"],
"uri": ["string", "http://localhost:8000/api/patients"],
"api_denormalize": ["boolean", true],
"cache_key": ["string", "e83f0aaf1c78a8d5386bc220724081e1"]
}]
]
}, {
"namespace": "Symfony\Component\Serializer\Normalizer",
"short_class": "AbstractObjectNormalizer",
"class": "Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer",
"type": "-u003E",
"function": "validateAndDenormalize",
"file": "G:\6.programacion\from git\Veterinaria\vendor\symfony\serializer\Normalizer\AbstractObjectNormalizer.php",
"line": 259,
"args": [
["string", "App\Entity\PatientDisease"],
["string", "disease"],
["string", "/api/diseases/4"],
["string", "json"],
["array", {
"groups": ["array", [
["string", "patient"]
]],
"collection_operation_name": ["string", "post"],
"operation_type": ["string", "collection"],
"api_allow_update": ["boolean", true],
"resource_class": ["string", "App\Entity\PatientDisease"],
"request_uri": ["string", "/api/patients"],
"uri": ["string", "http://localhost:8000/api/patients"],
"api_denormalize": ["boolean", true],
"cache_key": ["string", "e83f0aaf1c78a8d5386bc220724081e1"]
}]
]
}, {
"namespace": "Symfony\Component\Serializer\Normalizer",
"short_class": "AbstractObjectNormalizer",
"class": "Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer",
"type": "-u003E",
"function": "denormalize",
"file": "G:\6.programacion\from git\Veterinaria\vendor\symfony\serializer\Serializer.php",
"line": 177,
"args": [
["array", {
"patient": ["array", ],
"date": ["string", "2018-11-27T13:03:00.000Z"],
"disease": ["string", "/api/diseases/4"]
}],
["string", "App\Entity\PatientDisease"],
["string", "json"],
["array", {
"groups": ["array", [
["string", "patient"]
]],
"collection_operation_name": ["string", "post"],
"operation_type": ["string", "collection"],
"api_allow_update": ["boolean", true],
"resource_class": ["string", "App\Entity\PatientDisease"],
"request_uri": ["string", "/api/patients"],
"uri": ["string", "http://localhost:8000/api/patients"],
"api_denormalize": ["boolean", true],
"cache_key": ["string", "e83f0aaf1c78a8d5386bc220724081e1"]
}]
]
}, {
"namespace": "Symfony\Component\Serializer",
"short_class": "Serializer",
"class": "Symfony\Component\Serializer\Serializer",
"type": "-u003E",
"function": "denormalize",
"file": "G:\6.programacion\from git\Veterinaria\vendor\api-platform\core\src\Serializer\AbstractItemNormalizer.php",
"line": 307,
"args": [
["array", {
"patient": ["array", ],
"date": ["string", "2018-11-27T13:03:00.000Z"],
"disease": ["string", "/api/diseases/4"]
}],
["string", "App\Entity\PatientDisease"],
["string", "json"],
["array", {
"groups": ["array", [
["string", "patient"]
]],
"collection_operation_name": ["string", "post"],
"operation_type": ["string", "collection"],
"api_allow_update": ["boolean", true],
"resource_class": ["string", "App\Entity\PatientDisease"],
"request_uri": ["string", "/api/patients"],
"uri": ["string", "http://localhost:8000/api/patients"],
"api_denormalize": ["boolean", true],
"cache_key": ["string", "e83f0aaf1c78a8d5386bc220724081e1"]
}]
]
}, {
"namespace": "ApiPlatform\Core\Serializer",
"short_class": "AbstractItemNormalizer",
"class": "ApiPlatform\Core\Serializer\AbstractItemNormalizer",
"type": "-u003E",
"function": "denormalizeRelation",
"file": "G:\6.programacion\from git\Veterinaria\vendor\api-platform\core\src\Serializer\AbstractItemNormalizer.php",
"line": 272,
"args": [
["string", "patientDiseases"],
["object", "ApiPlatform\Core\Metadata\Property\PropertyMetadata"],
["string", "App\Entity\PatientDisease"],
["array", {
"patient": ["array", ],
"date": ["string", "2018-11-27T13:03:00.000Z"],
"disease": ["string", "/api/diseases/4"]
}],
["string", "json"],
["array", {
"groups": ["array", [
["string", "patient"]
]],
"collection_operation_name": ["string", "post"],
"operation_type": ["string", "collection"],
"api_allow_update": ["boolean", true],
"resource_class": ["string", "App\Entity\PatientDisease"],
"request_uri": ["string", "/api/patients"],
"uri": ["string", "http://localhost:8000/api/patients"],
"api_denormalize": ["boolean", true],
"cache_key": ["string", "e83f0aaf1c78a8d5386bc220724081e1"]
}]
]
}, {
"namespace": "ApiPlatform\Core\Serializer",
"short_class": "AbstractItemNormalizer",
"class": "ApiPlatform\Core\Serializer\AbstractItemNormalizer",
"type": "-u003E",
"function": "denormalizeCollection",
"file": "G:\6.programacion\from git\Veterinaria\vendor\api-platform\core\src\Serializer\AbstractItemNormalizer.php",
"line": 204,
"args": [
["string", "patientDiseases"],
["object", "ApiPlatform\Core\Metadata\Property\PropertyMetadata"],
["object", "Symfony\Component\PropertyInfo\Type"],
["string", "App\Entity\PatientDisease"],
["array", [
["array", {
"patient": ["array", ],
"date": ["string", "2018-11-27T13:03:00.000Z"],
"disease": ["string", "/api/diseases/4"]
}]
]],
["string", "json"],
["array", {
"groups": ["array", [
["string", "patient"]
]],
"collection_operation_name": ["string", "post"],
"operation_type": ["string", "collection"],
"api_allow_update": ["boolean", false],
"resource_class": ["string", "App\Entity\Patient"],
"request_uri": ["string", "/api/patients"],
"uri": ["string", "http://localhost:8000/api/patients"],
"api_denormalize": ["boolean", true],
"cache_key": ["string", "e83f0aaf1c78a8d5386bc220724081e1"]
}]
]
}, {
"namespace": "ApiPlatform\Core\Serializer",
"short_class": "AbstractItemNormalizer",
"class": "ApiPlatform\Core\Serializer\AbstractItemNormalizer",
"type": "-u003E",
"function": "setAttributeValue",
"file": "G:\6.programacion\from git\Veterinaria\vendor\symfony\serializer\Normalizer\AbstractObjectNormalizer.php",
"line": 261,
"args": [
["object", "App\Entity\Patient"],
["string", "patientDiseases"],
["array", [
["array", {
"patient": ["array", ],
"date": ["string", "2018-11-27T13:03:00.000Z"],
"disease": ["string", "/api/diseases/4"]
}]
]],
["string", "json"],
["array", {
"groups": ["array", [
["string", "patient"]
]],
"collection_operation_name": ["string", "post"],
"operation_type": ["string", "collection"],
"api_allow_update": ["boolean", false],
"resource_class": ["string", "App\Entity\Patient"],
"request_uri": ["string", "/api/patients"],
"uri": ["string", "http://localhost:8000/api/patients"],
"api_denormalize": ["boolean", true],
"cache_key": ["string", "e83f0aaf1c78a8d5386bc220724081e1"]
}]
]
}, {
"namespace": "Symfony\Component\Serializer\Normalizer",
"short_class": "AbstractObjectNormalizer",
"class": "Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer",
"type": "-u003E",
"function": "denormalize",
"file": "G:\6.programacion\from git\Veterinaria\vendor\api-platform\core\src\Serializer\AbstractItemNormalizer.php",
"line": 132,
"args": [
["array", {
"name": ["string", "perro"],
"age": ["integer", 8],
"specie": ["string", "/api/species/1"],
"breed": ["string", "/api/breeds/1"],
"birthdate": ["string", "2018-11-07T13:03:00.000Z"],
"entrydate": ["string", "2018-11-23T13:03:03.182Z"],
"gender": ["string", "/api/genders/1"],
"temperament": ["string", "/api/temperaments/1"],
"chip": ["string", "asdasd2asd"],
"coatType": ["string", "/api/coat_types/1"],
"coatColor": ["string", "/api/coat_colors/1"],
"details": ["string", "m.cxvczxjkcxzvjklczv"],
"status": ["string", "/api/status_patients/1"],
"client": ["array", {
"name": ["string", "Juan"],
"lastName": ["string", "Alberto"],
"secondSurname": ["string", "Asdasd"],
"email": ["string", "asdasd@asdasd.as"],
"phone1": ["string", "234234"],
"phone2": ["string", "24234"],
"clientType": ["string", "/api/client_types/1"],
"sector": ["string", "/api/sectors/1"],
"identificationCard": ["string", "98989898989"],
"address": ["string", "sdfsdfsdfs sdf sd5f sd"]
}],
"isActive": ["boolean", true],
"surgeries": ["array", [
["array", {
"name": ["string", "sdfa fsdf"],
"date": ["string", "2018-11-30T13:03:00.000Z"],
"patient": ["array", ]
}],
["array", {
"name": ["string", "sdfa fsdf"],
"date": ["string", "2018-11-30T13:03:00.000Z"],
"patient": ["array", ]
}],
["array", {
"name": ["string", "sdfa fsdf"],
"date": ["string", "2018-11-30T13:03:00.000Z"],
"patient": ["array", ]
}],
["array", {
"name": ["string", "sdfa fsdf"],
"date": ["string", "2018-11-30T13:03:00.000Z"],
"patient": ["array", ]
}]
]],
"patientDiseases": ["array", [
["array", {
"patient": ["array", ],
"date": ["string", "2018-11-27T13:03:00.000Z"],
"disease": ["string", "/api/diseases/4"]
}]
]]
}],
["string", "App\Entity\Patient"],
["string", "json"],
As you can see the IRI is present in the request in every object of the array but api-platform still raising an error of Invalid IRI.
The entities are configured with cascade persist option
Do you have any advice on how could I resolve this situation?
Thanks in advance
symfony symfony4 bad-request api-platform.com iri
Working in a vuejs app with axios I have some data structured as follow:
{
...
surgeries: ,//array of object
patientDiseases: [
{
date: a javascrtipt date,
disease: /api/diseases/#id //This is a valid IRI provided by the api in a select
}
] //array of object
}
When I post this data set api-platform's response is Invalid value provided (invalid IRI?)
Here is the stack trace
{
"@context": "/api/contexts/Error",
"@type": "hydra:Error",
"hydra:title": "An error occurred",
"hydra:description": "Invalid value provided (invalid IRI?).",
"trace": [{
"namespace": "",
"short_class": "",
"class": "",
"type": "",
"function": "",
"file": "G:\6.programacion\from git\Veterinaria\vendor\api-platform\core\src\Serializer\AbstractItemNormalizer.php",
"line": 177,
"args":
}, {
"namespace": "ApiPlatform\Core\Serializer",
"short_class": "AbstractItemNormalizer",
"class": "ApiPlatform\Core\Serializer\AbstractItemNormalizer",
"type": "-u003E",
"function": "setAttributeValue",
"file": "G:\6.programacion\from git\Veterinaria\vendor\symfony\serializer\Normalizer\AbstractObjectNormalizer.php",
"line": 261,
"args": [
["object", "App\Entity\Disease"],
["integer", 0],
["string", "/api/diseases/4"],
["string", "json"],
["array", {
"groups": ["array", [
["string", "patient"]
]],
"collection_operation_name": ["string", "post"],
"operation_type": ["string", "collection"],
"api_allow_update": ["boolean", true],
"resource_class": ["string", "App\Entity\PatientDisease"],
"request_uri": ["string", "/api/patients"],
"uri": ["string", "http://localhost:8000/api/patients"],
"api_denormalize": ["boolean", true],
"cache_key": ["string", "e83f0aaf1c78a8d5386bc220724081e1"]
}]
]
}, {
"namespace": "Symfony\Component\Serializer\Normalizer",
"short_class": "AbstractObjectNormalizer",
"class": "Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer",
"type": "-u003E",
"function": "denormalize",
"file": "G:\6.programacion\from git\Veterinaria\vendor\api-platform\core\src\Serializer\AbstractItemNormalizer.php",
"line": 132,
"args": [
["string", "/api/diseases/4"],
["string", "App\Entity\Disease"],
["string", "json"],
["array", {
"groups": ["array", [
["string", "patient"]
]],
"collection_operation_name": ["string", "post"],
"operation_type": ["string", "collection"],
"api_allow_update": ["boolean", true],
"resource_class": ["string", "App\Entity\PatientDisease"],
"request_uri": ["string", "/api/patients"],
"uri": ["string", "http://localhost:8000/api/patients"],
"api_denormalize": ["boolean", true],
"cache_key": ["string", "e83f0aaf1c78a8d5386bc220724081e1"]
}]
]
}, {
"namespace": "ApiPlatform\Core\Serializer",
"short_class": "AbstractItemNormalizer",
"class": "ApiPlatform\Core\Serializer\AbstractItemNormalizer",
"type": "-u003E",
"function": "denormalize",
"file": "G:\6.programacion\from git\Veterinaria\vendor\api-platform\core\src\Serializer\ItemNormalizer.php",
"line": 43,
"args": [
["string", "/api/diseases/4"],
["string", "App\Entity\Disease"],
["string", "json"],
["array", {
"groups": ["array", [
["string", "patient"]
]],
"collection_operation_name": ["string", "post"],
"operation_type": ["string", "collection"],
"api_allow_update": ["boolean", true],
"resource_class": ["string", "App\Entity\PatientDisease"],
"request_uri": ["string", "/api/patients"],
"uri": ["string", "http://localhost:8000/api/patients"],
"api_denormalize": ["boolean", true],
"cache_key": ["string", "e83f0aaf1c78a8d5386bc220724081e1"]
}]
]
}, {
"namespace": "ApiPlatform\Core\Serializer",
"short_class": "ItemNormalizer",
"class": "ApiPlatform\Core\Serializer\ItemNormalizer",
"type": "-u003E",
"function": "denormalize",
"file": "G:\6.programacion\from git\Veterinaria\vendor\symfony\serializer\Serializer.php",
"line": 177,
"args": [
["string", "/api/diseases/4"],
["string", "App\Entity\Disease"],
["string", "json"],
["array", {
"groups": ["array", [
["string", "patient"]
]],
"collection_operation_name": ["string", "post"],
"operation_type": ["string", "collection"],
"api_allow_update": ["boolean", true],
"resource_class": ["string", "App\Entity\PatientDisease"],
"request_uri": ["string", "/api/patients"],
"uri": ["string", "http://localhost:8000/api/patients"],
"api_denormalize": ["boolean", true],
"cache_key": ["string", "e83f0aaf1c78a8d5386bc220724081e1"]
}]
]
}, {
"namespace": "Symfony\Component\Serializer",
"short_class": "Serializer",
"class": "Symfony\Component\Serializer\Serializer",
"type": "-u003E",
"function": "denormalize",
"file": "G:\6.programacion\from git\Veterinaria\vendor\symfony\serializer\Normalizer\AbstractObjectNormalizer.php",
"line": 334,
"args": [
["string", "/api/diseases/4"],
["string", "App\Entity\Disease"],
["string", "json"],
["array", {
"groups": ["array", [
["string", "patient"]
]],
"collection_operation_name": ["string", "post"],
"operation_type": ["string", "collection"],
"api_allow_update": ["boolean", true],
"resource_class": ["string", "App\Entity\PatientDisease"],
"request_uri": ["string", "/api/patients"],
"uri": ["string", "http://localhost:8000/api/patients"],
"api_denormalize": ["boolean", true],
"cache_key": ["string", "e83f0aaf1c78a8d5386bc220724081e1"]
}]
]
}, {
"namespace": "Symfony\Component\Serializer\Normalizer",
"short_class": "AbstractObjectNormalizer",
"class": "Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer",
"type": "-u003E",
"function": "validateAndDenormalize",
"file": "G:\6.programacion\from git\Veterinaria\vendor\symfony\serializer\Normalizer\AbstractObjectNormalizer.php",
"line": 259,
"args": [
["string", "App\Entity\PatientDisease"],
["string", "disease"],
["string", "/api/diseases/4"],
["string", "json"],
["array", {
"groups": ["array", [
["string", "patient"]
]],
"collection_operation_name": ["string", "post"],
"operation_type": ["string", "collection"],
"api_allow_update": ["boolean", true],
"resource_class": ["string", "App\Entity\PatientDisease"],
"request_uri": ["string", "/api/patients"],
"uri": ["string", "http://localhost:8000/api/patients"],
"api_denormalize": ["boolean", true],
"cache_key": ["string", "e83f0aaf1c78a8d5386bc220724081e1"]
}]
]
}, {
"namespace": "Symfony\Component\Serializer\Normalizer",
"short_class": "AbstractObjectNormalizer",
"class": "Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer",
"type": "-u003E",
"function": "denormalize",
"file": "G:\6.programacion\from git\Veterinaria\vendor\symfony\serializer\Serializer.php",
"line": 177,
"args": [
["array", {
"patient": ["array", ],
"date": ["string", "2018-11-27T13:03:00.000Z"],
"disease": ["string", "/api/diseases/4"]
}],
["string", "App\Entity\PatientDisease"],
["string", "json"],
["array", {
"groups": ["array", [
["string", "patient"]
]],
"collection_operation_name": ["string", "post"],
"operation_type": ["string", "collection"],
"api_allow_update": ["boolean", true],
"resource_class": ["string", "App\Entity\PatientDisease"],
"request_uri": ["string", "/api/patients"],
"uri": ["string", "http://localhost:8000/api/patients"],
"api_denormalize": ["boolean", true],
"cache_key": ["string", "e83f0aaf1c78a8d5386bc220724081e1"]
}]
]
}, {
"namespace": "Symfony\Component\Serializer",
"short_class": "Serializer",
"class": "Symfony\Component\Serializer\Serializer",
"type": "-u003E",
"function": "denormalize",
"file": "G:\6.programacion\from git\Veterinaria\vendor\api-platform\core\src\Serializer\AbstractItemNormalizer.php",
"line": 307,
"args": [
["array", {
"patient": ["array", ],
"date": ["string", "2018-11-27T13:03:00.000Z"],
"disease": ["string", "/api/diseases/4"]
}],
["string", "App\Entity\PatientDisease"],
["string", "json"],
["array", {
"groups": ["array", [
["string", "patient"]
]],
"collection_operation_name": ["string", "post"],
"operation_type": ["string", "collection"],
"api_allow_update": ["boolean", true],
"resource_class": ["string", "App\Entity\PatientDisease"],
"request_uri": ["string", "/api/patients"],
"uri": ["string", "http://localhost:8000/api/patients"],
"api_denormalize": ["boolean", true],
"cache_key": ["string", "e83f0aaf1c78a8d5386bc220724081e1"]
}]
]
}, {
"namespace": "ApiPlatform\Core\Serializer",
"short_class": "AbstractItemNormalizer",
"class": "ApiPlatform\Core\Serializer\AbstractItemNormalizer",
"type": "-u003E",
"function": "denormalizeRelation",
"file": "G:\6.programacion\from git\Veterinaria\vendor\api-platform\core\src\Serializer\AbstractItemNormalizer.php",
"line": 272,
"args": [
["string", "patientDiseases"],
["object", "ApiPlatform\Core\Metadata\Property\PropertyMetadata"],
["string", "App\Entity\PatientDisease"],
["array", {
"patient": ["array", ],
"date": ["string", "2018-11-27T13:03:00.000Z"],
"disease": ["string", "/api/diseases/4"]
}],
["string", "json"],
["array", {
"groups": ["array", [
["string", "patient"]
]],
"collection_operation_name": ["string", "post"],
"operation_type": ["string", "collection"],
"api_allow_update": ["boolean", true],
"resource_class": ["string", "App\Entity\PatientDisease"],
"request_uri": ["string", "/api/patients"],
"uri": ["string", "http://localhost:8000/api/patients"],
"api_denormalize": ["boolean", true],
"cache_key": ["string", "e83f0aaf1c78a8d5386bc220724081e1"]
}]
]
}, {
"namespace": "ApiPlatform\Core\Serializer",
"short_class": "AbstractItemNormalizer",
"class": "ApiPlatform\Core\Serializer\AbstractItemNormalizer",
"type": "-u003E",
"function": "denormalizeCollection",
"file": "G:\6.programacion\from git\Veterinaria\vendor\api-platform\core\src\Serializer\AbstractItemNormalizer.php",
"line": 204,
"args": [
["string", "patientDiseases"],
["object", "ApiPlatform\Core\Metadata\Property\PropertyMetadata"],
["object", "Symfony\Component\PropertyInfo\Type"],
["string", "App\Entity\PatientDisease"],
["array", [
["array", {
"patient": ["array", ],
"date": ["string", "2018-11-27T13:03:00.000Z"],
"disease": ["string", "/api/diseases/4"]
}]
]],
["string", "json"],
["array", {
"groups": ["array", [
["string", "patient"]
]],
"collection_operation_name": ["string", "post"],
"operation_type": ["string", "collection"],
"api_allow_update": ["boolean", false],
"resource_class": ["string", "App\Entity\Patient"],
"request_uri": ["string", "/api/patients"],
"uri": ["string", "http://localhost:8000/api/patients"],
"api_denormalize": ["boolean", true],
"cache_key": ["string", "e83f0aaf1c78a8d5386bc220724081e1"]
}]
]
}, {
"namespace": "ApiPlatform\Core\Serializer",
"short_class": "AbstractItemNormalizer",
"class": "ApiPlatform\Core\Serializer\AbstractItemNormalizer",
"type": "-u003E",
"function": "setAttributeValue",
"file": "G:\6.programacion\from git\Veterinaria\vendor\symfony\serializer\Normalizer\AbstractObjectNormalizer.php",
"line": 261,
"args": [
["object", "App\Entity\Patient"],
["string", "patientDiseases"],
["array", [
["array", {
"patient": ["array", ],
"date": ["string", "2018-11-27T13:03:00.000Z"],
"disease": ["string", "/api/diseases/4"]
}]
]],
["string", "json"],
["array", {
"groups": ["array", [
["string", "patient"]
]],
"collection_operation_name": ["string", "post"],
"operation_type": ["string", "collection"],
"api_allow_update": ["boolean", false],
"resource_class": ["string", "App\Entity\Patient"],
"request_uri": ["string", "/api/patients"],
"uri": ["string", "http://localhost:8000/api/patients"],
"api_denormalize": ["boolean", true],
"cache_key": ["string", "e83f0aaf1c78a8d5386bc220724081e1"]
}]
]
}, {
"namespace": "Symfony\Component\Serializer\Normalizer",
"short_class": "AbstractObjectNormalizer",
"class": "Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer",
"type": "-u003E",
"function": "denormalize",
"file": "G:\6.programacion\from git\Veterinaria\vendor\api-platform\core\src\Serializer\AbstractItemNormalizer.php",
"line": 132,
"args": [
["array", {
"name": ["string", "perro"],
"age": ["integer", 8],
"specie": ["string", "/api/species/1"],
"breed": ["string", "/api/breeds/1"],
"birthdate": ["string", "2018-11-07T13:03:00.000Z"],
"entrydate": ["string", "2018-11-23T13:03:03.182Z"],
"gender": ["string", "/api/genders/1"],
"temperament": ["string", "/api/temperaments/1"],
"chip": ["string", "asdasd2asd"],
"coatType": ["string", "/api/coat_types/1"],
"coatColor": ["string", "/api/coat_colors/1"],
"details": ["string", "m.cxvczxjkcxzvjklczv"],
"status": ["string", "/api/status_patients/1"],
"client": ["array", {
"name": ["string", "Juan"],
"lastName": ["string", "Alberto"],
"secondSurname": ["string", "Asdasd"],
"email": ["string", "asdasd@asdasd.as"],
"phone1": ["string", "234234"],
"phone2": ["string", "24234"],
"clientType": ["string", "/api/client_types/1"],
"sector": ["string", "/api/sectors/1"],
"identificationCard": ["string", "98989898989"],
"address": ["string", "sdfsdfsdfs sdf sd5f sd"]
}],
"isActive": ["boolean", true],
"surgeries": ["array", [
["array", {
"name": ["string", "sdfa fsdf"],
"date": ["string", "2018-11-30T13:03:00.000Z"],
"patient": ["array", ]
}],
["array", {
"name": ["string", "sdfa fsdf"],
"date": ["string", "2018-11-30T13:03:00.000Z"],
"patient": ["array", ]
}],
["array", {
"name": ["string", "sdfa fsdf"],
"date": ["string", "2018-11-30T13:03:00.000Z"],
"patient": ["array", ]
}],
["array", {
"name": ["string", "sdfa fsdf"],
"date": ["string", "2018-11-30T13:03:00.000Z"],
"patient": ["array", ]
}]
]],
"patientDiseases": ["array", [
["array", {
"patient": ["array", ],
"date": ["string", "2018-11-27T13:03:00.000Z"],
"disease": ["string", "/api/diseases/4"]
}]
]]
}],
["string", "App\Entity\Patient"],
["string", "json"],
As you can see the IRI is present in the request in every object of the array but api-platform still raising an error of Invalid IRI.
The entities are configured with cascade persist option
Do you have any advice on how could I resolve this situation?
Thanks in advance
symfony symfony4 bad-request api-platform.com iri
symfony symfony4 bad-request api-platform.com iri
asked Nov 23 '18 at 14:56
Juan I. Morales PestanaJuan I. Morales Pestana
632221
632221
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
have you been able to find the reason of this behaviour? I am just facing probably the same issue.
$ composer info
api-platform/core v2.3.5 Build a fully-featured hypermedia or GraphQL API in minutes
symfony/serializer v4.2.2 Symfony Serializer Component
If (in your example) surgeries is ManyToMany relation, you can easily use IRI and Entity gets created. If patientDiseases is OneToMany (in fact it is ManyToMany too, but with extra attributes), using of IRI inside of object collection returns Exception above. And the object normalization looks weird:
["object", "App\Entity\Disease"], -> $object
["integer", 0], -> $attribute, but here it uses key 0 from array/collection instead of 'disease'?!
["string", "/api/diseases/4"], -> $value
After many attempts I have been able to find just a workaround. The entity with expected name here PatientDisease has to be defined as ApiResource with at least mandatory GET itemOperation (which can be easily a dummy controller returning always "not found"). Then ApiPlatform probably understands better the format of object collection and new embedded entity gets successfully created.
I do not know whether this is an expected behaviour or a bug. But I hope this may help also others :-)
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53448916%2fapi-platform-error-on-post-invalid-value-provided-invalid-iri%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
have you been able to find the reason of this behaviour? I am just facing probably the same issue.
$ composer info
api-platform/core v2.3.5 Build a fully-featured hypermedia or GraphQL API in minutes
symfony/serializer v4.2.2 Symfony Serializer Component
If (in your example) surgeries is ManyToMany relation, you can easily use IRI and Entity gets created. If patientDiseases is OneToMany (in fact it is ManyToMany too, but with extra attributes), using of IRI inside of object collection returns Exception above. And the object normalization looks weird:
["object", "App\Entity\Disease"], -> $object
["integer", 0], -> $attribute, but here it uses key 0 from array/collection instead of 'disease'?!
["string", "/api/diseases/4"], -> $value
After many attempts I have been able to find just a workaround. The entity with expected name here PatientDisease has to be defined as ApiResource with at least mandatory GET itemOperation (which can be easily a dummy controller returning always "not found"). Then ApiPlatform probably understands better the format of object collection and new embedded entity gets successfully created.
I do not know whether this is an expected behaviour or a bug. But I hope this may help also others :-)
add a comment |
have you been able to find the reason of this behaviour? I am just facing probably the same issue.
$ composer info
api-platform/core v2.3.5 Build a fully-featured hypermedia or GraphQL API in minutes
symfony/serializer v4.2.2 Symfony Serializer Component
If (in your example) surgeries is ManyToMany relation, you can easily use IRI and Entity gets created. If patientDiseases is OneToMany (in fact it is ManyToMany too, but with extra attributes), using of IRI inside of object collection returns Exception above. And the object normalization looks weird:
["object", "App\Entity\Disease"], -> $object
["integer", 0], -> $attribute, but here it uses key 0 from array/collection instead of 'disease'?!
["string", "/api/diseases/4"], -> $value
After many attempts I have been able to find just a workaround. The entity with expected name here PatientDisease has to be defined as ApiResource with at least mandatory GET itemOperation (which can be easily a dummy controller returning always "not found"). Then ApiPlatform probably understands better the format of object collection and new embedded entity gets successfully created.
I do not know whether this is an expected behaviour or a bug. But I hope this may help also others :-)
add a comment |
have you been able to find the reason of this behaviour? I am just facing probably the same issue.
$ composer info
api-platform/core v2.3.5 Build a fully-featured hypermedia or GraphQL API in minutes
symfony/serializer v4.2.2 Symfony Serializer Component
If (in your example) surgeries is ManyToMany relation, you can easily use IRI and Entity gets created. If patientDiseases is OneToMany (in fact it is ManyToMany too, but with extra attributes), using of IRI inside of object collection returns Exception above. And the object normalization looks weird:
["object", "App\Entity\Disease"], -> $object
["integer", 0], -> $attribute, but here it uses key 0 from array/collection instead of 'disease'?!
["string", "/api/diseases/4"], -> $value
After many attempts I have been able to find just a workaround. The entity with expected name here PatientDisease has to be defined as ApiResource with at least mandatory GET itemOperation (which can be easily a dummy controller returning always "not found"). Then ApiPlatform probably understands better the format of object collection and new embedded entity gets successfully created.
I do not know whether this is an expected behaviour or a bug. But I hope this may help also others :-)
have you been able to find the reason of this behaviour? I am just facing probably the same issue.
$ composer info
api-platform/core v2.3.5 Build a fully-featured hypermedia or GraphQL API in minutes
symfony/serializer v4.2.2 Symfony Serializer Component
If (in your example) surgeries is ManyToMany relation, you can easily use IRI and Entity gets created. If patientDiseases is OneToMany (in fact it is ManyToMany too, but with extra attributes), using of IRI inside of object collection returns Exception above. And the object normalization looks weird:
["object", "App\Entity\Disease"], -> $object
["integer", 0], -> $attribute, but here it uses key 0 from array/collection instead of 'disease'?!
["string", "/api/diseases/4"], -> $value
After many attempts I have been able to find just a workaround. The entity with expected name here PatientDisease has to be defined as ApiResource with at least mandatory GET itemOperation (which can be easily a dummy controller returning always "not found"). Then ApiPlatform probably understands better the format of object collection and new embedded entity gets successfully created.
I do not know whether this is an expected behaviour or a bug. But I hope this may help also others :-)
answered Mar 15 at 15:32
Jan StefanidesJan Stefanides
161
161
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53448916%2fapi-platform-error-on-post-invalid-value-provided-invalid-iri%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown