-
-
Notifications
You must be signed in to change notification settings - Fork 825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
APIv4 - don't throw exception when updating/deleting 0 items #16374
Conversation
(Standard links)
|
test fails relate here @colemanw |
63941dd
to
ff8584d
Compare
I tested this and it works as described and seems sensible. BEFORE this change: Attempting a CiviCRM API4 delete call with no records found resulted in an error message like "Cannot delete Activity, no records found with subject = 1111" WITH this change it results in an empty array. |
@colemanw this is a philosophical difference to apiv3 - being able to do things differently is obviously part of the point of apiv4 - but is it documented clearly as a difference? |
As someone new to API v4, I have to admit I see it more like a SQL query builder than an API like V3. As such I was surprised that a delete call (which allows multiple deletions now, like SQL) threw an exception if there was nothing to delete. So I think this change is sensible. Api3 was/is full of inconsistencies around how records can be specified, so I think this pr makes apiv4 more consistent and easier to document. |
I'm not opposed I just think this is a 'needs documentation' |
I started to add docs to this then realized that |
Not from me. It seems correct on something that takes search parameters that it should deal with whatever results there are or aren't. |
Update: I've updated this PR to update |
Overview
When 0 items are found to be processed by batch actions, it's not really an error so we shouldn't throw an exception.
Before
*UpdateAction
andDAODeleteAction
throw exceptions when 0 items found.After
No exception, just returns an empty result.