Open nohponex opened 7 years ago
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
$recordDataAttribute
$callbacks
Currently, when a Resource is parsed using parseFromRecord($record) it will:
Resource
parseFromRecord($record)
On the other hand when inserting new resources using handlePost
TYPE_TO_ONE
TYPE_TO_MANY
Should we have similar behaviour for post ?
@alkallio
Relationship class is defined as
So data can be fetched/manipulated using
$recordDataAttribute
or$callbacks
objectCurrently, when a
Resource
is parsed usingparseFromRecord($record)
it will:$recordDataAttribute
is defined, and that property is defined in given recordOn the other hand when inserting new resources using handlePost
TYPE_TO_ONE
attribute will be injected to inserted recordTYPE_TO_MANY
it 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 ?
$recordDataAttribute
, both forTYPE_TO_ONE
andTYPE_TO_MANY
, it will inject attribute to inserted record