-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
Milestone
Description
Relationship class is defined as
<?php
public function __construct(
ResourceModel $model,
int $type = Relationship::TYPE_TO_ONE,
string $recordDataAttribute = null,
\stdClass $callbacks = null,
int $flags = Relationship::FLAG_DEFAULT
)So data can be fetched/manipulated using $recordDataAttribute or $callbacks object
Currently, when a Resource is parsed using parseFromRecord($record) it will:
- check if
$recordDataAttributeis defined, and that property is defined in given record - if no then it will check if $callbacks defines a GET callback to retrieve the data
On the other hand when inserting new resources using handlePost
- If it's
TYPE_TO_ONEattribute will be injected to inserted record - If it's
TYPE_TO_MANYit will use POST callback to insert the data after the record is created (it will also throw an exception if POST is not defined)
Should we have similar behaviour for post ?
- If
$recordDataAttribute, both forTYPE_TO_ONEandTYPE_TO_MANY, it will inject attribute to inserted record - If not will will require POST callback to be defined