Apiwrapper doubts
I have a bug that is caused by the [APIWrapper](https://lab.civicrm.org/extensions/action-provider/-/blob/master/Civi/ActionProvider/APIWrapper.php) The APIWrapper adds extra functionality to prevent the retrieval of deleted items. For Contact, Case and Activity it adds the `is_deleted`parameter to the API call, in the case a careless developer might forget this. And for linked entities it adds the same parameter with a foreign key lookup. It is, however, too optimistic about the capabilities of the CiviCRM API it uses. I will give an example with relationship and case. In class `GetRelationshipByContactId`the following API call is made on line 92 `civicrm_api3('Relationship', 'getsingle', $relationshipFindParams)` with for example the following values in $relationshipFindParams; ``` $relationshipFindParams = array ( 'contact_id_a' => '33', 'relationship_type_id' => '22', 'is_active' => '1', 'options' => array ( 'limit' => 1, ), ) ``` The `civicrm_relation_ship` table has a `case_id` column and the Apiwrapper adds the parameter `'case_id.is_deleted' => 0` to the call making the parameter set ``` $relationshipFindParams = array ( 'contact_id_a' => '33', 'relationship_type_id' => '22', 'is_active' => '1', 'options' => array ( 'limit' => 1, ), 'case_id.is_deleted' => 0 ) ``` This parameter prevents the retrieval of a relationship that is connected to a deleted case. The side effect is that it also prevents the retrieval of all relationships that are not connected to a case, because the `case_id.is_deleted` is implemented with an inner join instead of a left join. The effect is that the `GetRelationshipByContactId` cannot find any case that is not connected to a case. I have no easy solution for this because it is generic that changes a lot of app-calls. In https://lab.civicrm.org/extensions/action-provider/-/tree/apiwrappernolinkedentities I have removed the linked entities functionality because that solves the acute need for customer I am now working for. The same project works also with expenses that have an case_id column that maybe filled. But maybe there is more clever fix. (for example an improvement for the 'case_id.is_deleted' in CiviCRM).
issue