$baoName = _civicrm_api3_get_BAO($entity);
$bao = new $baoName();
- $this->entityFieldNames = _civicrm_api3_field_names(_civicrm_api3_build_fields_array($bao));
+ $this->entityFieldNames = array_column($baoName::fields(), 'name');
$this->apiFieldSpec = $this->getFields();
$this->query = \CRM_Utils_SQL_Select::from($bao->tableName() . ' ' . self::MAIN_TABLE_ALIAS);
if (!isset($fkField['FKApiSpec'])) {
$fkField['FKApiSpec'] = \_civicrm_api_get_fields($fkField['FKApiName']);
}
- $fieldInfo = \CRM_Utils_Array::value($fieldName, $fkField['FKApiSpec']);
+ $fieldInfo = $fkField['FKApiSpec'][$fieldName] ?? NULL;
$keyColumn = \CRM_Utils_Array::value('FKKeyColumn', $fkField, 'id');
if (!$fieldInfo || !isset($fkField['FKApiSpec'][$keyColumn])) {
protected function getJoinInfo(&$fkField, $stack) {
if ($fkField['name'] == 'entity_id') {
$entityTableParam = substr(implode('.', $stack), 0, -2) . 'table';
- $entityTable = \CRM_Utils_Array::value($entityTableParam, $this->where);
+ $entityTable = $this->where[$entityTableParam] ?? NULL;
if ($entityTable && is_string($entityTable) && \CRM_Core_DAO_AllCoreTables::getClassForTable($entityTable)) {
$fkField['FKClassName'] = \CRM_Core_DAO_AllCoreTables::getClassForTable($entityTable);
$fkField['FKApiName'] = \CRM_Core_DAO_AllCoreTables::getBriefName($fkField['FKClassName']);
* Get acl clause for an entity
*
* @param string $tableAlias
- * @param string $baoName
+ * @param \CRM_Core_DAO|string $baoName
* @param array $stack
* @return array
*/