public function buildRelationshipData($type, $ids)
    {
        if ($ids === null || (is_array($ids) && empty($ids))) {
            return null;
        }

        // one relationship to add
        if (is_string($ids)) {
            return [
                'type' => $type,
                'id' => $ids
            ];
        }

        // many relationships to add
        $data = [];
        if(!empty($ids)) {
            foreach($ids as $id) {
                $data[] = [
                    'type' => $type,
                    'id' => $id
                ];
            }
        }
        return $data;
    }
public function buildRelationshipData($type, $ids)
    {
        if ($ids === null || (is_array($ids) && empty($ids))) {
            return null;
        }

        // one relationship to add
        if (is_string($ids)) {
            return [
                'type' => $type,
                'id' => $ids
            ];
        }

        // many relationships to add
        $data = [];
        if(!empty($ids)) {
            foreach($ids as $id) {
                $data[] = [
                    'type' => $type,
                    'id' => $id
                ];
            }
        }
        return $data;
    }
public function buildRelationshipData ( $ type , $ ids ) { if ( $ ids === null || ( is_array ( $ ids ) && empty ( $ ids ) ) ) { return null ; } // one relationship to add if ( is_string ( $ ids ) ) { return [ 'type' => $ type , 'id' => $ ids ] ; } // many relationships to add $ data = [ ] ; if ( ! empty ( $ ids ) ) { foreach ( $ ids as $ id ) { $ data [ ] = [ 'type' => $ type , 'id' => $ id ] ; } } return $ data ; }
build the body data for a relationship call

@param string $type the type of resource you're relating to (eg 'category')
@param array $ids an array of UUID's for the resources you're relating to
@return array|null if an array of id's is valid return them, otherwise retun null
build the body data for a relationship call