Skip to content

Commit

Permalink
Make map_annotation nids cantor paired ints [MA-156]
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhiltri committed Mar 1, 2024
1 parent c4e31d7 commit d21d222
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/Models/Transformers/AnnotationTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,20 @@

use A17\Twill\Models\Contracts\TwillModelContract;
use League\Fractal\TransformerAbstract;
use App\Helpers\Util;

class AnnotationTransformer extends TransformerAbstract
{
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",
Expand Down

0 comments on commit d21d222

Please sign in to comment.