Skip to content

500s when creating attachments #967

@PiotrKuligowski

Description

@PiotrKuligowski

curl -X POST "$PARTDB_URL/api/attachments"
-H "Authorization: Bearer $PARTDB_TOKEN"
-H "Content-Type: application/ld+json"
-H "Accept: application/ld+json"
-d '{
"_type": "Part",
"name": "STM32F103 Datasheet",
"element": {
"name": "/api/parts/$PART_ID"
},
"attachment_type": {
"name": "/api/attachment_types/1"
},
"url": "https://www.st.com/resource/en/datasheet/stm32f103c8.pdf",
"upload": {
"downloadUrl": true,
"private": false,
"becomePreviewIfEmpty": true
}
}'
{"@id":"/api/errors/400","@type":"hydra:Error","title":"An error occurred","detail":"You tried to create a new entity through the relation \u0027App\Entity\Attachments\Attachment#attachment_type\u0027 that was not configured to cascade persist operations for entity: /api/attachment_types/1. To solve this issue: Either explicitly call EntityManager#persist() on this unknown entity or configure cascade persist this association in the mapping for example #[ORM\ManyToOne(..., cascade: [\u0027persist\u0027, but this is not allowed. Please create the entity first and then reference it through an IRI!","status":400,"type":"/errors/400","description":"You tried to create a new entity through the relation \u0027App\Entity\Attachments\Attachment#attachment_type\u0027 that was not configured to cascade persist operations for entity: /api/attachment_types/1. To solve this issue: Either explicitly call EntityManager#persist() on this unknown entity or configure cascade persist this association in the mapping for example #[ORM\ManyToOne(..., cascade: [\u0027persist\u0027, but this is not allowed. Please create the entity first and then reference it through an IRI!","hydra:description":"You tried to create a new entity through the relation \u0027App\Entity\Attachments\Attachment#attachment_type\u0027 that was not configured to cascade persist operations for entity: /api/attachment_types/1. To solve this issue: Either explicitly call EntityManager#persist() on this unknown entity or configure cascade persist this association in the mapping for example #[ORM\ManyToOne(..., cascade: [\u0027persist\u0027, but this is not allowed. Please create the entity first and then reference it through an IRI!","hydra:title":"An error occurred"}%

Tried already multiple ways but can't get over this issue. Please help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions