dataloader-php icon indicating copy to clipboard operation
dataloader-php copied to clipboard

Returned data preconditions

Open simPod opened this issue 6 years ago • 2 comments
trafficstars

– The Array of values must be the same length as the Array of keys. – Each index in the Array of values must correspond to the same index in the Array of keys.

This confused me, can you point me to part of code where I can examine this logic? Thanks!

simPod avatar Mar 28 '19 09:03 simPod

This limitation was introduce in a first place by promise adapters like ReactPromise by example. But this limitation is maybe outdated.

mcg-web avatar Mar 28 '19 10:03 mcg-web

Got it, thanks. Found the actual mapping here https://github.com/overblog/dataloader-php/blob/master/src/DataLoader.php#L366

There is a property key on $data. Can be probably used for value lookup when result is indexed by that key.

simPod avatar Mar 28 '19 18:03 simPod