Ents with a field edge get that edge created automatically (and removed automatically when unset) through their builder. This is done in the getEditedFields method of the builder, as defined in the builder template (specifically line 291):
So the checks in getEditedFields always fail. I think the simplest way to get around this is to just add a check for this.operation === WriteOperation.Delete to always call removeInboundEdge even when input is empty. Thus changing the call to look like this:
This bug doesn't have much effect since the ents are deleted so fetching edges doesn't return deleted ents, but when you try to do something like event.queryEntries().queryRawCount(), that only fetches over the edge table, which will now return a bad count.
Ents with a field edge get that edge created automatically (and removed automatically when unset) through their builder. This is done in the
getEditedFields
method of the builder, as defined in the builder template (specifically line 291):https://github.com/lolopinto/ent/blob/47372cfd6c0376753c805a2249ed3428866077b7/internal/tscode/builder.tmpl#L276-L295
The generated code ends up looking something like this:
This method is passed into the Orchestrator in the constructor of the builder like this:
This works great for insert/update operations, but fails with delete actions. This is because the delete action always defines
getInput
asSo the checks in
getEditedFields
always fail. I think the simplest way to get around this is to just add a check forthis.operation === WriteOperation.Delete
to always callremoveInboundEdge
even wheninput
is empty. Thus changing the call to look like this:This bug doesn't have much effect since the ents are deleted so fetching edges doesn't return deleted ents, but when you try to do something like
event.queryEntries().queryRawCount()
, that only fetches over the edge table, which will now return a bad count.