ExportXMLWordPrintableJSON

    • Type: Task
    • Resolution: Unresolved
    • Priority: Unknown
    • None
    • Affects Version/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Filament finds records that can still be attached to a BelongsToMany relationship with a pivot-table sub-select (whereNotExists(select 1 from pivot ... whereColumn ...)), which throws on MongoDB at render time. It offers this hook on the relationship class instead (filamentphp/filament#20442):

      public function newUnattachedQuery(): \Illuminate\Database\Eloquent\Builder
      

      Our BelongsToMany keeps the attached related keys as an array on the parent document, so the implementation is a fresh query on the related model with {{whereNotIn(relatedKey, parent->

      {relatedPivotKey}

      )}}, preserving the relationship's own constraints and leaving the query modifiable by Filament. Must be a real public method on MongoDB\Laravel\Relations\BelongsToMany.

      Filament features this enables: TableSelect and ModalTableSelect form fields with ignoreRelatedRecords(), and AttachAction::tableSelect() in relation managers. Today these break the whole form page on MongoDB.

              Assignee:
              Pauline Vos
              Reporter:
              Pauline Vos
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: