From d21d2229ff6e1a10ec3dfb3ceec8c609ceab1ada Mon Sep 17 00:00:00 2001 From: nikhiltri Date: Fri, 1 Mar 2024 15:15:55 -0600 Subject: [PATCH] Make map_annotation nids cantor paired ints [MA-156] --- app/Models/Transformers/AnnotationTransformer.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/Models/Transformers/AnnotationTransformer.php b/app/Models/Transformers/AnnotationTransformer.php index 1547392e..27bb9c0e 100644 --- a/app/Models/Transformers/AnnotationTransformer.php +++ b/app/Models/Transformers/AnnotationTransformer.php @@ -4,6 +4,7 @@ use A17\Twill\Models\Contracts\TwillModelContract; use League\Fractal\TransformerAbstract; +use App\Helpers\Util; class AnnotationTransformer extends TransformerAbstract { @@ -11,11 +12,12 @@ public function transform(TwillModelContract $annotation) { $type = $annotation->types->first(); $category = $type->category; + $nid = Util::cantorPair($annotation->id, $annotation->annotation_type_id); return [ - "$annotation->id:$annotation->annotation_type_id" => [ + $nid => [ 'title' => $annotation->title, 'status' => "1", // Legacy from Drupal - 'nid' => (string) "$annotation->id:$annotation->annotation_type_id", // Legacy from Drupal + 'nid' => $nid, // Legacy from Drupal 'type' => 'map_annotation', // Legacy from Drupal 'translations' => [], // TODO Determine what data the mobile app requires 'location' => "$annotation->latitude,$annotation->longitude",