Skip to content
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 - Add Dashboard & DashboardContact entities #16867

Merged
merged 5 commits into from
Mar 25, 2020

Conversation

colemanw
Copy link
Member

Overview

Adds APIv4 support for Dashboard & DashboardContact and does some cleanup in the BAO and API layers for improved consistency.

Before

No v4 API; older code patterns used.

After

API added, with tests; newer code patterns used.

@civibot
Copy link

civibot bot commented Mar 20, 2020

(Standard links)

@@ -56,7 +56,7 @@
</index>
<field>
<name>column_no</name>
<type>boolean</type>
<type>int</type>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand why they did this originally. boolean translates to tinyint in mysql (range 0-255), which I guess saves a few bytes in the database since column_number is always going to be a very small number. But now that APIv4 is stricter about field types, this gets output as true and false by api.get... which is 💩

Too bad our schema xml doesn't allow a tinyint unsigned field type, but this will do. Uses a few more bytes of disc space but whatever.

Strictly speaking this requires updating the schema sql and a database upgrade, except it doesn't matter since this change is just for the benefit of php not sql.

@colemanw
Copy link
Member Author

retest this please

@colemanw
Copy link
Member Author

retest this pleaseee


// Try and find an existing dashlet - it will be updated if found.
if (!empty($params['name'])) {
if (!empty($params['name']) || !empty($params['url'])) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@colemanw is this aiming to fix a bug or something, I'm not clear why we are condensing the if / else here, The code doesn't seem to be the same after

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's essentially the same before/after. The only difference is that if both params are passed in they will both be taken into account in the search, which seems like an improvement.

}
else {
$dashlet->id = $dashboardID;
}

if (isset($params['permission']) && is_array($params['permission'])) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am assuming you removed this to rely on the copyValues but the field doesn't have a serialize type in the schema so that won't happen

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah sorry - you DID add it - I thought the above change was that DAO

*
* @package CRM
* @copyright CiviCRM LLC https://civicrm.org/licensing
* $Id$
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we NOT add this $Id$

@eileenmcnaughton
Copy link
Contributor

OK - this all makes sense - we should remove $ids - but that is non-blocking

@eileenmcnaughton eileenmcnaughton merged commit 064037b into civicrm:master Mar 25, 2020
@eileenmcnaughton eileenmcnaughton deleted the dashboard branch March 25, 2020 01:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants