odata-client-php icon indicating copy to clipboard operation
odata-client-php copied to clipboard

Is it possible to post (insert) an entity and related entities via in one call?

Open joey-carlisle4 opened this issue 2 years ago • 1 comments

I tried something like this (it didn't work). Is there a way to accomplish this or nah?

$data =  [
  'foo'=>1,
  'bar'=>2,
  'RelationshipKey'=>['baz'=>3],
];
$client = new ODataClient($url);
$client->query()->expand('RelationshipKey')->post('EntityName', $data);

joey-carlisle4 avatar Apr 15 '22 18:04 joey-carlisle4

Have you tried it with just the call to post and omitting expand?

anderly avatar Sep 07 '23 05:09 anderly