Skip to content
Snippets Groups Projects
Unverified Commit 4f353dc2 authored by Seamus Lee's avatar Seamus Lee Committed by GitHub
Browse files

Incorporate review suggestions from @mikeyMJCO


Co-Authored-By: default avatarMikey O'Toole <mikey@mjco.uk>
parent 8b1ec3e7
No related branches found
No related tags found
No related merge requests found
# APIv3 Chaining
It is now possible to do two API calls at once with the first call feeding into the second. E.g. to create a contact with a contribution you can nest the contribution create into the contact create. Once the contact has been created it will action the contribution create using the id from the contact create as `contact_id`. Likewise you can ask for all activities or all contributions to be returned when you do a get.
It is possible to do two API calls at once with the first call feeding into the second. E.g. to create a contact with a contribution you can nest the contribution create into the contact create. Once the contact has been created it will action the contribution create using the id from the contact create as `contact_id`. Likewise you can ask for all activities or all contributions to be returned when you do a `get`.
See [api/v3/examples](https://github.com/civicrm/civicrm-core/tree/master/api/v3/examples) within the core source code for a plethora of examples (from unit tests) that use chaining. To start, look at these examples:
......
# APIv4 Chaining
It is now possible to do two API calls at once with the first call feeding into the second. E.g. to create a contact with a contribution you can nest the contribution create into the contact create. Once the contact has been created it will action the contribution create using the id from the contact create as `contact_id`. Likewise you can ask for all activities or all contributions to be returned when you do a get.
It is possible to do two API calls at once with the first call feeding into the second. E.g. to create a contact with a contribution you can nest the contribution create into the contact create. Once the contact has been created it will action the contribution create using the id from the contact create as `contact_id`. Likewise you can ask for all activities or all contributions to be returned when you do a `get`.
Note that there are a few supported syntaxes:
......@@ -31,7 +31,7 @@ civicrm_api('Contact', 'create', [
]);
```
If you have 2 websites to create you can pass them as separate key => array pairs just specifiy a unique array key in the chain array
If you have 2 websites to create you can pass them as separate key => array pairs just specify a unique array key in the chain array
Object Oriented way
......
......@@ -10,7 +10,7 @@ To use a join in an API call, specify the name of the field on which the join ha
For instance, to search for all primary emails, returning the email and joining to also return the contact's display name:
Object oreinted way:
Object Oriented way:
```php
$result \Civi\Api4\Email::get()
......@@ -38,7 +38,7 @@ $result = civicrm_api4('Email', 'get', [
Alternatively, to return email addresses of everyone whose last name is Smith by joining to the Contact entity:
Object oreinted way:
Object Oriented way:
```php
$result \Civi\Api4\Email::get()
......@@ -61,7 +61,7 @@ $result = civicrm_api4('Email', 'get', [
You can join multiple times in one query. For instance, to return a list of events, displaying their name, the name of the related campaign, and that campaign's type:
Object oreinted way:
Object Oriented way:
```php
$result \Civi\Api4\Email::get()
......
......@@ -46,7 +46,7 @@ On the PR, click over to “Files Changed” and understand what the code is doi
## Reproduce the problem
Confirm which branch the PR was created against. This is probably either `master` or an Release Candidate branch. Setup an instance locally from that branch (e.g. with [buildkit](https://github.com/civicrm/civicrm-buildkit)), or test on the [public demo site if possible](https://civicrm.org/demo). Repeat the steps to reproduce described in the ticket or PR.
Confirm which branch the PR was created against. This is probably either `master` or a Release Candidate branch. Setup an instance locally from that branch (e.g. with [buildkit](https://github.com/civicrm/civicrm-buildkit)), or test on the [public demo site if possible](https://civicrm.org/demo). Repeat the steps to reproduce described in the ticket or PR.
Confirm that the issue was a problem and a problem “worth solving”, generally worthy of being in core.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment