jsonapi icon indicating copy to clipboard operation
jsonapi copied to clipboard

Import a database array as a collection response

Open lode opened this issue 10 years ago • 0 comments

It would be nice to do something like this:

$results = 'mysqli_query() + fetch_assoc() while-loop';
$jsonapi = new jsonapi\collection($type='users');
$jsonapi->import_from_array($results);

And maybe a way to split keys as relationships. Like import_from_array($array, $split_relation_names) or $array = collection::split_relations($array, $relation_names).

lode avatar Jun 09 '15 19:06 lode