Skip to content

Commit

Permalink
Suppress errors when reading DAO version constants
Browse files Browse the repository at this point in the history
  • Loading branch information
colemanw committed Aug 13, 2020
1 parent 9162496 commit 633a8db
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 3 additions & 3 deletions CRM/Core/DAO.php
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ public static function getSupportedFields($checkPermissions = FALSE) {

// Exclude fields yet not added by pending upgrades
$dbVer = \CRM_Core_BAO_Domain::version();
$daoExt = constant(static::class . '::EXT');
$daoExt = defined(static::class . '::EXT') ? constant(static::class . '::EXT') : NULL;
if ($fields && $daoExt === 'civicrm' && version_compare($dbVer, \CRM_Utils_System::version()) < 0) {
$fields = array_filter($fields, function($field) use ($dbVer) {
$add = $field['add'] ?? '1.0.0';
Expand Down Expand Up @@ -1161,8 +1161,8 @@ public static function tableHasBeenAdded() {
if (CRM_Utils_System::version() === CRM_Core_BAO_Domain::version()) {
return TRUE;
}
$daoExt = constant(static::class . '::EXT');
$daoVersion = constant(static::class . '::TABLE_ADDED') ?? '1.0';
$daoExt = defined(static::class . '::EXT') ? constant(static::class . '::EXT') : NULL;
$daoVersion = defined(static::class . '::TABLE_ADDED') ? constant(static::class . '::TABLE_ADDED') : '1.0';
return !($daoExt === 'civicrm' && version_compare(CRM_Core_BAO_Domain::version(), $daoVersion, '<'));
}

Expand Down
7 changes: 7 additions & 0 deletions Civi/Api4/Generic/Traits/CustomValueActionTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,11 @@ public function getCustomGroup() {
return $this->customGroup;
}

/**
* @return \CRM_Core_DAO|string
*/
protected function getBaoName() {
return \CRM_Core_BAO_CustomValue::class;
}

}

0 comments on commit 633a8db

Please sign in to comment.