Skip to content
Snippets Groups Projects
Commit ffce62ac authored by colemanw's avatar colemanw
Browse files

Fix table display

parent b16fdcec
No related branches found
No related tags found
1 merge request!756Fix table display
...@@ -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\Api4; namespace Civi\Api4;
class Website extends Generic\DAOEntity { class Website extends Generic\DAOEntity {
} }
``` </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.
......
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