Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Developer Documentation
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Documentation
Docs
Developer Documentation
Commits
ffce62ac
Commit
ffce62ac
authored
5 years ago
by
colemanw
Browse files
Options
Downloads
Patches
Plain Diff
Fix table display
parent
b16fdcec
No related branches found
Branches containing commit
No related tags found
1 merge request
!756
Fix table display
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
docs/api/v4/architecture.md
+22
-17
22 additions, 17 deletions
docs/api/v4/architecture.md
with
22 additions
and
17 deletions
docs/api/v4/architecture.md
+
22
−
17
View file @
ffce62ac
...
@@ -43,11 +43,19 @@ An API [`Result`](https://github.com/civicrm/civicrm-core/blob/master/Civi/Api4/
...
@@ -43,11 +43,19 @@ An API [`Result`](https://github.com/civicrm/civicrm-core/blob/master/Civi/Api4/
To reduce code duplication and enforce consistency, APIv4 uses PHP class inheritance extensively. Compare these examples:
To reduce code duplication and enforce consistency, APIv4 uses PHP class inheritance extensively. Compare these examples:
<div
markdown=
"1"
class=
"two-column"
>
<!-- Would be nice if Markdown made it easier to do side-by-side comparison... -->
<table>
**APIv3 Website.php**
<thead>
<tr>
```
php
<th>
APIv3 Website.php
</th>
<th>
APIv4 Website.php
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<pre
class=
"codehilite"
>
function civicrm_api3_website_get($params) {
function civicrm_api3_website_get($params) {
return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, TRUE, 'Website');
return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, TRUE, 'Website');
}
}
...
@@ -59,24 +67,21 @@ function civicrm_api3_website_create($params) {
...
@@ -59,24 +67,21 @@ function civicrm_api3_website_create($params) {
function civicrm_api3_website_delete($params) {
function civicrm_api3_website_delete($params) {
return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
}
}
```
</pre>
</td>
</div>
<td>
<div
markdown=
"1"
class=
"two-column"
>
**APIv4 Website.php**
<pre
class=
"codehilite"
>
```
php
namespace Civi
\A
pi4;
namespace Civi
\A
pi4;
class Website extends Generic
\D
AOEntity {
class Website extends Generic
\D
AOEntity {
}
}
```
</pre>
</td>
</div
>
</tr
>
</tbody>
---
</table>
These are typical CRUD APIs using generic functions to perform actions on the
`civicrm_website`
table.
These are typical CRUD APIs using generic functions to perform actions on the
`civicrm_website`
table.
The v3 file needed a function for each action, resulting in a lot of duplicate code across API files.
The v3 file needed a function for each action, resulting in a lot of duplicate code across API files.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment