- $simulations = Simulation::get()->filter([
- 'OrganisationGroups.ID' => [null, 1, 4]
This query also returns records that have been assigned to a OrganisationGroup that has been deleted, because there’s still a record in the mapping table.
how would you end up with a record in the mapping table with null value in the relation column? shouldn’t the ORM take care of this?
Depends. Unlink, yes. Delete, lolnoareyoucrazy? ¯_(ツ)_/¯
Please investigate though, the above is a mighty big assumption :)
It also depends on whether or not you are deleting via the ManyManyList, or the object itself.
which (if the latter) would also then depend on whether or not the
belongs_many_many is defined correctly too, if my assumption is an almighty wad of wrongness.
onAfterDelete or onBeforeDelete or something on DataObject would probably hold all the secrets :)
@MichalKleiner It’s not null, just using an ID that doesn’t exist
Like GroupID = 5 and SimulationID = 10, then the Group is deleted but that record remains