Skip to content

Commit

Permalink
APIv4 - Exclude non-db fields from query
Browse files Browse the repository at this point in the history
Only attempt to query field if it has a real db column (not a calculated or pseudo-field)
  • Loading branch information
colemanw committed May 29, 2021
1 parent 2bf220f commit bda2f04
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Civi/Api4/Query/Api4SelectQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -1059,6 +1059,10 @@ public function getExplicitJoin($alias) {
* @param array $field
*/
private function addSpecField($path, $field) {
// Only add field if it has a real db column (not a calculated or pseudo-field)
if (empty($field['column_name'])) {
return;
}
// Only add field to spec if we have permission
if ($this->getCheckPermissions() && !empty($field['permission']) && !\CRM_Core_Permission::check($field['permission'])) {
$this->apiFieldSpec[$path] = FALSE;
Expand Down

0 comments on commit bda2f04

Please sign in to comment.