-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Description
Hi there,
i want to upsert an Eloquent Model, but when sending a patchrequest, im getting the
following error:
{
"error": {
"code": "cannot_upsert_computed_key",
"message": "Cannot upsert on an entity set with a computed key",
"target": null,
"details": [],
"innererror": {}
}
}
The Model has default Primary KEY id, auto-increment. Is it not possible to upsert Models with Autoincrement Keys?
When setting an alternative Key for the Entity, using:
$recordType = Lodata::getEntityType('application_record');
$recordType->getProperty('record_number')->setAlternativeKey();
this is Ignored in the Upsert (Patch) Method, when using the following request:
PATCH /odata/Records(record_number='123-0001-222')
If we change this in: vendor/flat3/lodata/src/EntitySet.php
it works with the alternative key.
original:
public function negotiateUpsert(PropertyValue $entityId, Transaction $transaction): PipeInterface
{
$key = $this->getType()->getKey();
modified:
public function negotiateUpsert(PropertyValue $entityId, Transaction $transaction): PipeInterface
{
$key = $entityId->getProperty();
it seems to ignore the longForm key if specified and use the normal ID instead without this change.
Metadata
Metadata
Assignees
Labels
No labels