-
Notifications
You must be signed in to change notification settings - Fork 27
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Hi @JaZo ! Just don't figure how to set a relation to null when saving a content which had a previous relation set.
Relation "publisher" is a hasOne relation
This is the attributes/relations array prior to hydration. this array works as expected.
$ordineAttributes = [
note => $datiForm['note'],
'totale_ordine' => $datiForm['totale_ordine'],
'stato' => [
'id' => base64_decode($datiForm['stato'])
],
/* THIS IS THE RELATION I WANT TO EVENTUALLY SET TO NULL (OR SOMEWHAT SIMILAR) */
'publisher' => [
'id' => $datiForm['publisher']
],
'cliente' => [
'id' => $datiForm['cliente_id']
],
'righe_ordine' => $ids,
];
$itemOrdineDocument = $itemHydrator->hydrate(
$typeMapper->getMapping('node--ordini'),
$ordineAttributes,
$orderID
);
I already tried to:
- pass an empty
publisherarray - pass
publisher => null - pass
"id" => "none" - pass
"id" => "null" - pass
"id" => null - pass
"id" => 0
Of course, if I completely remove the publisher entry from the ordineAttributes array, the hydrator steps over and leaves the previous value unchanged.
What I'm doing wrong?
I also get errors when I do
$itemOrdineDocument->unsetRelation('publisher');
$ordineRepo->save($itemOrdineDocument);
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request