GenericValue removedValue = null;
if (testMode) {
removedValue = this.findOne(value.getEntityName(), value.getPrimaryKey(), false);
}
int num = helper.removeByPrimaryKey(value.getPrimaryKey());
// Need to call removedFromDatasource() here because the helper calls removedFromDatasource() on the PK instead of the GenericEntity.
value.removedFromDatasource();
if (doCacheClear) {
ecaRunner.evalRules(EntityEcaHandler.EV_CACHE_CLEAR, EntityEcaHandler.OP_REMOVE, value, false);
this.clearCacheLine(value);